Current File : /home/inlingua/www/dwarka/icentex/admin_cert/changeaction_cert.php |
<?php
session_start();
ob_start();
// Include the database connection details
require('../dbConnection.php');
// Include common functions
require('../commonFunc.php');
// Include common functions
require('../globalVars.php');
// Include the table handler class
require('../dbHandler.class.php');
// Setup table name, configuration and data entry form
$tableName = "timesheet_user";
/*$tableConf = $tableName . ".conf.php";
$dataForm = $tableName . ".form.php";
$viewForm = $tableName . ".view.php";
*/
// Init and connect to database
$dbObject = new dbHandler();
$dbObject->setTableName($tableName);
$dbObject->setDbFieldList($dbFieldList);
$dbObject->setKeyFieldName("recNo");
$dbObject->connect();
// Retrieve parameters from request
$dbObject->getDbFieldsFromRequest();
// Records selection sql
$sqlQuery = "SELECT * FROM timesheet_user where username='".$_SESSION['username']."' and password='".$_REQUEST['oldpass']."' and usertype='certificate_admin'";
// Select records from table
$selectedRecords = $dbObject->Select($sqlQuery);
// If no records selected, print message
if (!$selectedRecords)
{
$_SESSION['chpass']="Old password is wrong";
header("Location: changepass_cert.php");
//header(Location :)
}
if ($selectedRecords)
{
$dbObject->setDbField("password",$_REQUEST['newpass']);
if ($dbObject->Update("recNo",$_SESSION['id']))
{
$_SESSION['chpass']="Password changed successfully";
header("Location: changepass_cert.php");
}
}
// Print navigation bar
?>