Current File : /home/inlingua/www/icentex/indeed-test/admin.action.php |
<?php
ini_set('session.gc_maxlifetime',3*60*60);
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 * FROM ingl_admission where ref_No='".$_REQUEST['username']."' and password='".$_REQUEST['passwd']."'";
// Select records from table
$selectedRecords = $dbObject->Select($sqlQuery);
// If no records selected, print message
if (!$selectedRecords)
{
$_SESSION['wrongpass']="Username or Password Wrong";
header("Location: index.php");
//header(Location :)
}
if ($selectedRecords)
{
$queryC="select * from ingl_test_category where recNo='".$objectData['test_category']."'";
$resultC=mysqli_query($conn,$queryC);
$countC=mysqli_num_rows($resultC);
$numC=mysqli_fetch_array($resultC);
$objectData=$dbObject->SelectNext();
$_SESSION['test']=$objectData['test_category'];
$_SESSION['test_name']=$numC['category'];
$_SESSION['sid']=$objectData['recNo'];
$_SESSION['SLogin']=$objectData['login'];
$_SESSION['utype']="Student";
$_SESSION['testBy']="Stu";
$_SESSION['studentName']="".$objectData['firstName']." ".$objectData['lastName']."";
$location="ingl_test_instr.select.php";
$queryW="select * from ingl_test_answer where student_id='".$objectData['recNo']."'";
$resultW=mysqli_query($conn,$queryW);
$countW=mysqli_num_rows($resultW);
$numW=mysqli_fetch_array($resultW);
if($countW>0)
{
$_SESSION['wrongpass']="Already Attempted Test";
header("Location: index.php");
}
else{
header("Location:".$location."");
}
}
// Print navigation bar
?>