Current File : /home/inlingua/public_html/noida/icentex_noida/pg/admin.action.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');

// Init and connect to database
$dbObject = new dbHandler();
$dbObject->connect();



// Records selection sql
$sqlQuery = "SELECT recNo,username,password,usertype,name,primarycenter,startingHours,pay_type,designation,rates_designation,indeed,timesheet_admin,timesheet,eoc_admin,eoc,fd,leavetrackeradmin,leavetracker,courserecordadmin,courserecord,toutorials_forms,pauadmin,pau,workshops_admin,workshops_trainee,workshops_trainer,admin_conveyance,conveyance,fd_incenter,fd_payment_gateway,fd_reports,incenter_admin,calendar_admin,calendar_super_admin,calendar,oral_admin,oral FROM timesheet_user where username='".$_POST['username']."' and password='".$_POST['passwd']."' and status='Active' limit 0,1";


// Select records from table
$selectedRecords = $dbObject->Select($sqlQuery);


// If no records selected, print message
if (!$selectedRecords)
{	
$_SESSION['wrongpass']="User ID or Password Wrong";
header("Location: index.php");
//header(Location :)

}
if ($selectedRecords)
{	
$objectData=$dbObject->SelectNext();

if($objectData['password']!=$_POST['passwd']){	
$_SESSION['wrongpass']="User ID or Password Wrong";
header("Location: index.php");
die();
}

$_SESSION['id']=$objectData['recNo'];
$_SESSION['username']=$objectData['username'];
$_SESSION['usertype']=$objectData['usertype'];
$_SESSION['name1']=$objectData['name'];
$_SESSION['branch']=$objectData['primarycenter'];
$_SESSION['startingHours']=$objectData['startingHours'];
$_SESSION['pay_type']=$objectData['pay_type'];
$_SESSION['designation']=$objectData['designation'];
$_SESSION['rates_designation']=$objectData['rates_designation'];

include("modules.php");
$allowed_modules_1=array("home");
//print_r($modules);
foreach($modules as $key => $val)
{

if($objectData[$key]=="Y")
{
$allowed_modules_1[]=$key;
}

} 

$_SESSION['allowed_modules']=$allowed_modules_1;

$totalHours=$objectData['startingHours'];

/*$query="select (sum(hours1) + sum(hours2) + sum(hours3) + sum(hours4) +  sum(hours5) +  sum(hours7) +  sum(hours8) + sum(hours9)) as totalhrs  from timesheet where instructorId='".$objectData[recNo]."' && status_send=1 && approve_status=1 && modify_status!='1' && modify_status!='3'";

$result=mysql_query($query) or die(mysql_error());

$num=mysql_fetch_array($result);

$totalHours=$totalHours+$num[totalhrs];

if($totalHours<500)
{
$rate="Rate1";

}
elseif($totalHours>=500 && $totalHours<1000)
{
$rate="Rate2";
}
elseif($totalHours>=1000 && $totalHours<1500)
{
$rate="Rate3";
}
else if($totalHours>=1500)
{
$rate="Rate4";
}

*/


//$queryRU="update timesheet_user set rateGroup='".$rate."' where recNo='".$objectData['recNo']."'";
//$resultRU=mysql_query($queryRU) or die(mysql_query());
/*if($objectData['usertype']=='user') header("Location: home.php");
if($objectData['usertype']=='certificate_admin') header("Location: admin_cert/admin_cert.php");
if($objectData['usertype']=='fd_admin') header("Location: admin_fd/admin_fd.php");
if($objectData['usertype']=='attn_admin') header("Location: admin_attendance/admin_attendance.php");
if($objectData['usertype']=='updates_admin') header("Location: admin_procedures/admin_procedure.php");
if($objectData['usertype']=='trainer_admin') header("Location: trainer_resource_admin/admin_trainer.php");
*/
//header("Location: ../inl/pg/admin_in.php");
header("Location: home.php");
}


// Print navigation bar
?>