Re-LogIn"; } else if (isset($_REQUEST['logout'])) { /* * ************************ Step 2 - Case 1 ************************ */ //Log out and redirect login page unset($_SESSION['tcname']); header('Location: index.php'); } else if (isset($_REQUEST['dashboard'])) { /* * ************************ Step 2 - Case 2 ************************ */ //redirect to dashboard header('Location: tcwelcome.php'); } else if (isset($_REQUEST['delete'])) { /* * ************************ Step 2 - Case 3 ************************ */ //deleting the selected Tests unset($_REQUEST['delete']); $hasvar = false; foreach ($_REQUEST as $variable) { if (is_numeric($variable)) { //it is because, some session values are also passed with request $hasvar = true; if (!@executeQuery("delete from test where testid=$variable and tcid=" . $_SESSION['tcid'] . ";")) { if (mysql_errno () == 1451) //Children are dependent value $_GLOBALS['message'] = "Too Prevent accidental deletions, system will not allow propagated deletions.
Help: If you still want to delete this Test, then first delete the questions that are assoicated with it."; else $_GLOBALS['message'] = mysql_errno(); } } } if (!isset($_GLOBALS['message']) && $hasvar == true) $_GLOBALS['message'] = "Selected Tests are successfully Deleted"; else if (!$hasvar) { $_GLOBALS['message'] = "First Select the Tests to be Deleted."; } } else if (isset($_REQUEST['savem'])) { /* * ************************ Step 2 - Case 4 ************************ */ //updating the modified values $fromtime = $_REQUEST['testfrom'] . " " . date("H:i:s"); $totime = $_REQUEST['testto'] . " 23:59:59"; $_GLOBALS['message'] = strtotime($totime) . " " . strtotime($fromtime) . " " . time(); if (strtotime($fromtime) > strtotime($totime) || strtotime($totime) < time()) $_GLOBALS['message'] = "Start date of test is less than end date or last date of test is less than today's date.
Therefore Nothing is Updated"; else if (empty($_REQUEST['testname']) || empty($_REQUEST['testdesc']) || empty($_REQUEST['totalqn']) || empty($_REQUEST['duration']) || empty($_REQUEST['testfrom']) || empty($_REQUEST['testto']) || empty($_REQUEST['testcode'])) { $_GLOBALS['message'] = "Some of the required Fields are Empty.Therefore Nothing is Updated"; } else { $query = "update test set testname='" . htmlspecialchars($_REQUEST['testname'], ENT_QUOTES) . "',testdesc='" . htmlspecialchars($_REQUEST['testdesc'], ENT_QUOTES) . "',subid=" . $_REQUEST['subject'] . ",testfrom='" . $fromtime . "',testto='" . $totime . "',duration=" . htmlspecialchars($_REQUEST['duration'], ENT_QUOTES) . ",totalquestions=" . htmlspecialchars($_REQUEST['totalqn'], ENT_QUOTES) . ",testcode=ENCODE('" . htmlspecialchars($_REQUEST['testcode'], ENT_QUOTES) . "','oespass') where testid=" . $_REQUEST['testid'] . " and tcid=" . $_SESSION['tcid'] . ";"; if (!@executeQuery($query)) $_GLOBALS['message'] = mysql_error(); else $_GLOBALS['message'] = "Test Information is Successfully Updated."; } closedb(); } else if (isset($_REQUEST['savea'])) { /* * ************************ Step 2 - Case 5 ************************ */ //Add the new Test information in the database $noerror = true; $fromtime = $_REQUEST['testfrom'] . " " . date("H:i:s"); $totime = $_REQUEST['testto'] . " 23:59:59"; if (strtotime($fromtime) > strtotime($totime) || strtotime($fromtime) < (time() - 3600)) { $noerror = false; $_GLOBALS['message'] = "Start date of test is either less than today's date or greater than last date of test."; } else if ((strtotime($totime) - strtotime($fromtime)) <= 3600 * 24) { $noerror = true; $_GLOBALS['message'] = "Note:
The test is valid upto " . date(DATE_RFC850, strtotime($totime)); } //$_GLOBALS['message']="time".date_format($first, DATE_ATOM)."
time ".date_format($second, DATE_ATOM); $result = executeQuery("select max(testid) as tst from test"); $r = mysql_fetch_array($result); if (is_null($r['tst'])) $newstd = 1; else $newstd=$r['tst'] + 1; // $_GLOBALS['message']=$newstd; if (strcmp($_REQUEST['subject'], "") == 0 || empty($_REQUEST['testname']) || empty($_REQUEST['testdesc']) || empty($_REQUEST['totalqn']) || empty($_REQUEST['duration']) || empty($_REQUEST['testfrom']) || empty($_REQUEST['testto']) || empty($_REQUEST['testcode'])) { $_GLOBALS['message'] = "Some of the required Fields are Empty"; } else if ($noerror) { $query = "insert into test values($newstd,'" . htmlspecialchars($_REQUEST['testname'], ENT_QUOTES) . "','" . htmlspecialchars($_REQUEST['testdesc'], ENT_QUOTES) . "',(select curDate()),(select curTime())," . $_REQUEST['subject'] . ",'" . $fromtime . "','" . $totime . "'," . htmlspecialchars($_REQUEST['duration'], ENT_QUOTES) . "," . htmlspecialchars($_REQUEST['totalqn'], ENT_QUOTES) . ",0,ENCODE('" . htmlspecialchars($_REQUEST['testcode'], ENT_QUOTES) . "','oespass')," . $_SESSION['tcid'] . ")"; if (!@executeQuery($query)) { if (mysql_errno () == 1062) //duplicate value $_GLOBALS['message'] = "Given Test Name voilates some constraints, please try with some other name."; else $_GLOBALS['message'] = mysql_error(); } else $_GLOBALS['message'] = $_GLOBALS['message'] . "
Successfully New Test is Created."; } closedb(); } else if (isset($_REQUEST['manageqn'])) { /* * ************************ Step 2 - Case 6 ************************ */ //Store the Test identity in session varibles and redirect to prepare question section. //$tempa=explode(" ",$_REQUEST['testqn']); // $testname=substr($_REQUEST['manageqn'],0,-10); $testname = $_REQUEST['manageqn']; $result = executeQuery("select testid from test where testname='$testname' and tcid=" . $_SESSION['tcid'] . ";"); if ($r = mysql_fetch_array($result)) { $_SESSION['testname'] = $testname; $_SESSION['testqn'] = $r['testid']; // $_GLOBALS['message']=$_SESSION['testname']; header('Location: prepqn.php'); } } ?> OES-Manage Tests " . $_GLOBALS['message'] . ""; } ?>
OES

 Online Examination System

...because Examination Matters

Which test questions Do you want to Manage?
Help:Click on Questions button to manage the questions of respective tests
"; if (isset($_REQUEST['add'])) { /* * ************************ Step 3 - Case 1 ************************ */ //Form for the new Test ?>
Subject Name
Test Name
Note:
Test Name must be Unique
in order to identify different
tests on same subject.
Test Description
Describe here:
What the test is all about?
Total Questions
Duration(Mins)
Test From
Test To
Test Secret Code
Note:
Candidates must enter
this code in order to
take the test
Subject Name
Test Name
Note:
Test Name must be Unique
in order to identify different
tests on same subject.
Test Description
Describe here:
What the test is all about?
Total Questions
Duration(Mins)
Test From
Test To
Test Secret Code
Note:
Candidates must enter
this code in order to
take the test
No Tests Yet..!"; } else { $i = 0; ?> "; else echo ""; echo "" . "" . ""; } ?>
  Test Description Subject Name Test Secret Code Validity Edit Manage
Questions
" . htmlspecialchars_decode($r['testname'], ENT_QUOTES) . " : " . htmlspecialchars_decode($r['testdesc'], ENT_QUOTES) . "" . htmlspecialchars_decode($r['subname'], ENT_QUOTES) . "" . htmlspecialchars_decode($r['tcode'], ENT_QUOTES) . "" . $r['testfrom'] . " To " . $r['testto'] . "\"Edit\"\"Manage