Re-LogIn"; } else if (isset($_REQUEST['logout'])) { /* * ************************ Step 2 - Case 1 ************************ */ //Log out and redirect login page unset($_SESSION['admname']); header('Location: index.php'); } else if (isset($_REQUEST['dashboard'])) { /* * ************************ Step 2 - Case 2 ************************ */ //redirect to dashboard header('Location: admwelcome.php'); } else if (isset($_REQUEST['delete'])) { /* * ************************ Step 2 - Case 3 ************************ */ //deleting the selected Subjects 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 subject where subid=$variable")) { 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 subject, then first delete the tests that are conducted/dependent on this subject."; else $_GLOBALS['message'] = mysql_errno(); } } } if (!isset($_GLOBALS['message']) && $hasvar == true) $_GLOBALS['message'] = "Selected Subject/s are successfully Deleted"; else if (!$hasvar) { $_GLOBALS['message'] = "First Select the subject/s to be Deleted."; } } else if (isset($_REQUEST['savem'])) { /* * ************************ Step 2 - Case 4 ************************ */ //updating the modified values if (empty($_REQUEST['subname']) || empty($_REQUEST['subdesc'])) { $_GLOBALS['message'] = "Some of the required Fields are Empty.Therefore Nothing is Updated"; } else { $query = "update subject set subname='" . htmlspecialchars($_REQUEST['subname'], ENT_QUOTES) . "', subdesc='" . htmlspecialchars($_REQUEST['subdesc'], ENT_QUOTES) . "'where subid=" . $_REQUEST['subject'] . ";"; if (!@executeQuery($query)) $_GLOBALS['message'] = mysql_error(); else $_GLOBALS['message'] = "Subject Information is Successfully Updated."; } closedb(); } else if (isset($_REQUEST['savea'])) { /* * ************************ Step 2 - Case 5 ************************ */ //Add the new Subject information in the database $result = executeQuery("select max(subid) as sub from subject"); $r = mysql_fetch_array($result); if (is_null($r['sub'])) $newstd = 1; else $newstd=$r['sub'] + 1; $result = executeQuery("select subname as sub from subject where subname='" . htmlspecialchars($_REQUEST['subname'], ENT_QUOTES) . "';"); // $_GLOBALS['message']=$newstd; if (empty($_REQUEST['subname']) || empty($_REQUEST['subdesc'])) { $_GLOBALS['message'] = "Some of the required Fields are Empty"; } else if (mysql_num_rows($result) > 0) { $_GLOBALS['message'] = "Sorry Subject Already Exists."; } else { $query = "insert into subject values($newstd,'" . htmlspecialchars($_REQUEST['subname'], ENT_QUOTES) . "','" . htmlspecialchars($_REQUEST['subdesc'], ENT_QUOTES) . "',NULL)"; if (!@executeQuery($query)) { if (mysql_errno () == 1062) //duplicate value $_GLOBALS['message'] = "Given Subject Name voilates some constraints, please try with some other name."; else $_GLOBALS['message'] = mysql_error(); } else $_GLOBALS['message'] = "Successfully New Subject is Created."; } closedb(); } ?> OES-Manage Subjects " . $_GLOBALS['message'] . ""; } ?>
OES

 Online Examination System

...because Examination Matters

Subject Name
Subject Description
Subject Name
Subject Description
No Subjets Yet..!"; } else { $i = 0; ?> "; } else { echo ""; } echo "" . ""; } ?>
  Subject Name Subject Description Edit
" . htmlspecialchars_decode($r['subname'], ENT_QUOTES) . "" . htmlspecialchars_decode($r['subdesc'], ENT_QUOTES) . "\"Edit\"