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['managetests'])) { /* * ************************ Step 2 - Case 2 ************************ */ //redirect to Manage Tests Section header('Location: testmng.php'); } else if (isset($_REQUEST['delete'])) { /* * ************************ Step 2 - Case 3 ************************ */ //deleting the selected Questions unset($_REQUEST['delete']); $hasvar = false; $count = 1; 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 question where testid=" . $_SESSION['testqn'] . " and qnid=$variable")) $_GLOBALS['message'] = mysql_error(); } } //reordering questions $result = executeQuery("select qnid from question where testid=" . $_SESSION['testqn'] . " order by qnid;"); while ($r = mysql_fetch_array($result)) if (!@executeQuery("update question set qnid=" . ($count++) . " where testid=" . $_SESSION['testqn'] . " and qnid=" . $r['qnid'] . ";")) $_GLOBALS['message'] = mysql_error(); // if (!isset($_GLOBALS['message']) && $hasvar == true) $_GLOBALS['message'] = "Selected Questions are successfully Deleted"; else if (!$hasvar) { $_GLOBALS['message'] = "First Select the Questions to be Deleted."; } } else if (isset($_REQUEST['savem'])) { /* * ************************ Step 2 - Case 4 ************************ */ //updating the modified values // $_GLOBALS['message']=$newstd; if (strcmp($_REQUEST['correctans'], "") == 0 || empty($_REQUEST['question']) || empty($_REQUEST['optiona']) || empty($_REQUEST['optionb']) || empty($_REQUEST['optionc']) || empty($_REQUEST['optiond']) || empty($_REQUEST['marks'])) { $_GLOBALS['message'] = "Some of the required Fields are Empty"; } else if (strcasecmp($_REQUEST['optiona'], $_REQUEST['optionb']) == 0 || strcasecmp($_REQUEST['optiona'], $_REQUEST['optionc']) == 0 || strcasecmp($_REQUEST['optiona'], $_REQUEST['optiond']) == 0 || strcasecmp($_REQUEST['optionb'], $_REQUEST['optionc']) == 0 || strcasecmp($_REQUEST['optionb'], $_REQUEST['optiond']) == 0 || strcasecmp($_REQUEST['optionc'], $_REQUEST['optiond']) == 0) { $_GLOBALS['message'] = "Two or more options are representing same answers.Verify Once again"; } else { $query = "update question set question='" . htmlspecialchars($_REQUEST['question'], ENT_QUOTES) . "',optiona='" . htmlspecialchars($_REQUEST['optiona'], ENT_QUOTES) . "',optionb='" . htmlspecialchars($_REQUEST['optionb'], ENT_QUOTES) . "',optionc='" . htmlspecialchars($_REQUEST['optionc'], ENT_QUOTES) . "',optiond='" . htmlspecialchars($_REQUEST['optiond'], ENT_QUOTES) . "',correctanswer='" . htmlspecialchars($_REQUEST['correctans'], ENT_QUOTES) . "',marks=" . htmlspecialchars($_REQUEST['marks'], ENT_QUOTES) . " where testid=" . $_SESSION['testqn'] . " and qnid=" . $_REQUEST['qnid'] . " ;"; if (!@executeQuery($query)) $_GLOBALS['message'] = mysql_error(); else $_GLOBALS['message'] = "Question is updated Successfully."; } closedb(); } else if (isset($_REQUEST['savea'])) { /* * ************************ Step 2 - Case 5 ************************ */ //Add the new Question $cancel = false; $result = executeQuery("select max(qnid) as qn from question where testid=" . $_SESSION['testqn'] . ";"); $r = mysql_fetch_array($result); if (is_null($r['qn'])) $newstd = 1; else $newstd=$r['qn'] + 1; $result = executeQuery("select count(*) as q from question where testid=" . $_SESSION['testqn'] . ";"); $r2 = mysql_fetch_array($result); $result = executeQuery("select totalquestions from test where testid=" . $_SESSION['testqn'] . ";"); $r1 = mysql_fetch_array($result); if (!is_null($r2['q']) && (int) htmlspecialchars_decode($r1['totalquestions'], ENT_QUOTES) == (int) $r2['q']) { $cancel = true; $_GLOBALS['message'] = "Already you have created all the Questions for this Test.
Help: If you still want to add some more questions then edit the test settings(option:Total Questions)."; } else $cancel=false; $result = executeQuery("select * from question where testid=" . $_SESSION['testqn'] . " and question='" . htmlspecialchars($_REQUEST['question'], ENT_QUOTES) . "';"); if (!$cancel && $r1 = mysql_fetch_array($result)) { $cancel = true; $_GLOBALS['message'] = "Sorry, You trying to enter same question for Same test"; } else if (!$cancel) $cancel = false; // $_GLOBALS['message']=$newstd; if (strcmp($_REQUEST['correctans'], "") == 0 || empty($_REQUEST['question']) || empty($_REQUEST['optiona']) || empty($_REQUEST['optionb']) || empty($_REQUEST['optionc']) || empty($_REQUEST['optiond']) || empty($_REQUEST['marks'])) { $_GLOBALS['message'] = "Some of the required Fields are Empty"; } else if (strcasecmp($_REQUEST['optiona'], $_REQUEST['optionb']) == 0 || strcasecmp($_REQUEST['optiona'], $_REQUEST['optionc']) == 0 || strcasecmp($_REQUEST['optiona'], $_REQUEST['optiond']) == 0 || strcasecmp($_REQUEST['optionb'], $_REQUEST['optionc']) == 0 || strcasecmp($_REQUEST['optionb'], $_REQUEST['optiond']) == 0 || strcasecmp($_REQUEST['optionc'], $_REQUEST['optiond']) == 0) { $_GLOBALS['message'] = "Two or more options are representing same answers.Verify Once again"; } else if (!$cancel) { $query = "insert into question values(" . $_SESSION['testqn'] . ",$newstd,'" . htmlspecialchars($_REQUEST['question'], ENT_QUOTES) . "','" . htmlspecialchars($_REQUEST['optiona'], ENT_QUOTES) . "','" . htmlspecialchars($_REQUEST['optionb'], ENT_QUOTES) . "','" . htmlspecialchars($_REQUEST['optionc'], ENT_QUOTES) . "','" . htmlspecialchars($_REQUEST['optiond'], ENT_QUOTES) . "','" . htmlspecialchars($_REQUEST['correctans'], ENT_QUOTES) . "'," . htmlspecialchars($_REQUEST['marks'], ENT_QUOTES) . ")"; if (!@executeQuery($query)) $_GLOBALS['message'] = mysql_error(); else $_GLOBALS['message'] = "Successfully New Question is Created."; } closedb(); } ?> OES-Manage Questions " . $_GLOBALS['message'] . ""; } ?>
OES

 Online Examination System

...because Examination Matters

Test Name: " . $_SESSION['testname'] . "
Status: All the Questions are Created for this test.
"; else echo "
Test Name: " . $_SESSION['testname'] . "
Status: Still you need to create " . (htmlspecialchars_decode($r2['totalquestions'], ENT_QUOTES) - $r1['q']) . " Question/s. After that only, test will be available for candidates.
"; ?>
Question
Option A
Option B
Option C
Option D
Correct Answer
Marks
Question
Option A
Option B
Option C
Option D
Correct Answer
Marks
No Questions Yet..!"; } else { $i = 0; ?> "; else echo ""; echo "" . ""; } ?>
  Qn.No Question Correct Answer Marks Edit
" . $i . "" . htmlspecialchars_decode($r['question'], ENT_QUOTES) . "" . htmlspecialchars_decode($r[htmlspecialchars_decode($r['correctanswer'], ENT_QUOTES)], ENT_QUOTES) . "" . htmlspecialchars_decode($r['marks'], ENT_QUOTES) . "\"Edit\"" . "