Current File : /home/inlingua/public_html/icentex/admin/changeaction.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='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.php");
//header(Location :)

}
if ($selectedRecords)
{	
$dbObject->setDbField("password",$_REQUEST['newpass']);
if ($dbObject->Update("recNo",$_SESSION['id']))
{
$_SESSION['chpass']="Password change successfully";
header("Location: changepass.php");
}
}


// Print navigation bar
?>