Re-LogIn"; } else if(isset($_REQUEST['logout'])) { //Log out and redirect login page unset($_SESSION['stdname']); header('Location: index.php'); } else if(isset($_REQUEST['dashboard'])) { //redirect to dashboard header('Location: stdwelcome.php'); } else if(isset($_REQUEST['resume'])) { //test code preparation if($r=mysql_fetch_array($result=executeQuery("select testname from test where testid=".$_REQUEST['resume'].";"))) { $_SESSION['testname']=htmlspecialchars_decode($r['testname'],ENT_QUOTES); $_SESSION['testid']=$_REQUEST['resume']; } } else if(isset($_REQUEST['resumetest'])) { //Prepare the parameters needed for Test Conducter and redirect to test conducter if(!empty($_REQUEST['tc'])) { $result=executeQuery("select DECODE(testcode,'oespass') as tcode from test where testid=".$_SESSION['testid'].";"); if($r=mysql_fetch_array($result)) { if(strcmp(htmlspecialchars_decode($r['tcode'],ENT_QUOTES),htmlspecialchars($_REQUEST['tc'],ENT_QUOTES))!=0) { $display=true; $_GLOBALS['message']="You have entered an Invalid Test Code.Try again."; } else { //now prepare parameters for Test Conducter and redirect to it. $result=executeQuery("select totalquestions,duration from test where testid=".$_SESSION['testid'].";"); $r=mysql_fetch_array($result); $_SESSION['tqn']=htmlspecialchars_decode($r['totalquestions'],ENT_QUOTES); $_SESSION['duration']=htmlspecialchars_decode($r['duration'],ENT_QUOTES); $result=executeQuery("select DATE_FORMAT(starttime,'%Y-%m-%d %H:%i:%s') as startt,DATE_FORMAT(endtime,'%Y-%m-%d %H:%i:%s') as endt from studenttest where testid=".$_SESSION['testid']." and stdid=".$_SESSION['stdid'].";"); $r=mysql_fetch_array($result); $_SESSION['starttime']=$r['startt']; $_SESSION['endtime']=$r['endt']; $_SESSION['qn']=1; header('Location: testconducter.php'); } } else { $display=true; $_GLOBALS['message']="You have entered an Invalid Test Code.Try again."; } } else { $display=true; $_GLOBALS['message']="Enter the Test Code First!"; } } ?>
