<?php include "designtemplate.php"; include "database.php"; include "validation.php"; verify_authorization("admin"); function write_question_details() { $question = ""; $correct = ""; $distractor1 = ""; $distractor2 = ""; $distractor3 = ""; $type = "Add"; $url = "managequestion.php"; if (isset($_GET['question_id'])) { connect(); $id = $_GET['question_id']; $question_record = get_question($id); $question = $question_record['Question']; $correct = $question_record['CorrectAnswer']; $distractor1 = $question_record['Distractor1']; $distractor2 = $question_record['Distractor2']; $distractor3 = $question_record['Distractor3']; $type = "Edit"; $url .= "?question_id=" . $id; } echo "<form name = 'add_question_form' method = 'post' action = '" . $url . "'>\r\n\t\t\tQuestion <br/>\r\n\t\t\t<textarea rows = '4' cols = '50' name = 'question'>" . $question . "</textarea>\r\n\t\t\t<br/>\r\n\t\t\tCorrect Answer <br/>\r\n\t\t\t<textarea cols = '50' name = 'correct'>" . $correct . "</textarea>\r\n\t\t\t<br/>\r\n\t\t\tDistractor 1 <br/>\r\n\t\t\t<textarea cols = '50' name = 'distractor1'>" . $distractor1 . "</textarea>\r\n\t\t\t<br/>\r\n\t\t\tDistractor 2 <br/>\r\n\t\t\t<textarea cols = '50' name = 'distractor2'>" . $distractor2 . "</textarea>\r\n\t\t\t<br/>\r\n\t\t\tDistractor 3 <br/>\r\n\t\t\t<textarea cols = '50' name = 'distractor3'>" . $distractor3 . "</textarea>\r\n\t\t\t<br/>\r\n\t\t\t<input type = 'submit' name = 'submit_question' value = '" . $type . "'>\r\n\t\t</form>\r\n\t\t"; } ?>
<?php include "designtemplate.php"; include "database.php"; include "validation.php"; connect(); verify_authorization('admin'); ?> <?php if (isset($_POST['accept_button'])) { remove_user_from_requests($_REQUEST['username']); } if (isset($_POST['reject_button'])) { remove_user_from_requests($_REQUEST['username']); remove_user($_REQUEST['username']); } ?> <html> <head> <title>Requests</title> </head> <body> <form name = "requests_form" method = "post"> <?php $result = mysql_query("select * from requests"); $record = mysql_fetch_assoc($result);
<?php include "designtemplate.php"; include "database.php"; include "validation.php"; verify_authorization('student'); connect(); ?> <?php $exam_name = $_GET['exam_name']; $exam_id = $_GET['exam_id']; ?> <?php if (isset($_POST['submit_exam'])) { $correct_answers = 0; $total_questions = 0; $removed = array(); foreach ($_SESSION as $key => $value) { $arr = explode('_', $key); if ($arr[0] != 'question') { continue; } $id = $arr[1]; $post_variable = 'radio_' . $id; $total_questions++; if (isset($_POST[$post_variable]) && $value == $_POST[$post_variable]) { $correct_answers++; } $removed[] = $key;
<?php include "designtemplate.php"; include "validation.php"; include "database.php"; verify_authorization("student"); connect(); ?> <html> <head> <title> Take Exams </title> </head> <body> <h3> <?php $exams = get_exams(); foreach ($exams as $i => $exam) { echo $i + 1 . ") "; echo "<a href = 'enterexam.php?exam_id=" . $exam['ID'] . "&exam_name=" . $exam['Name'] . "'>" . $exam['Name'] . "</a>\n"; echo " "; echo "<a href = 'myresults.php?exam_id=" . $exam['ID'] . "&exam_name=" . $exam['Name'] . "'>(results)</a>\n"; echo "<br/>\n"; } ?> </h3> </body>