<!DOCTYPE html> <?php session_start(); require 'php/DBConnection.php'; require 'php/phpGeneral.php'; if (!isset($_SESSION["currentUser"])) { header("Location: ."); } ?> <?php $userInfo = $email = $name = $institution = $photo = ""; if (isset($_SESSION["currentUser"])) { $email = $_SESSION["currentUser"]; $userInfo = selectUserInfo($email); $_SESSION["name"] = $userInfo["name"]; $_SESSION["institution"] = $userInfo["institution"]; $_SESSION["password"] = $userInfo["password"]; } if (isset($_SESSION["name"])) { $name = $_SESSION["name"]; } if (isset($_SESSION["institution"])) { $institution = $_SESSION["institution"]; } if (isset($_SESSION["password"])) { $password = $_SESSION["password"]; } if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST["changePassword"])) { $_SESSION["name"] = $_POST["name"]; $_SESSION["institution"] = $_POST["institution"];
echo "successful"; } else { echo "Wrong Password"; } } else { echo "Wrong User Name"; } } if (isset($_POST["signup"])) { $inputEmail = $_POST["inputEmail"]; $name = $_POST["name"]; $inputPassword = $_POST["inputPassword"]; $retypePassword = $_POST["retypePassword"]; $institutionName = $_POST["institutionName"]; $photo = ""; if (selectUserInfo($inputEmail) != null) { echo "This email already used for another account !"; } else { insertUserInfo($inputEmail, $inputPassword, $name, $institutionName, $photo); $_SESSION["currentUser"] = $_POST["inputEmail"]; echo "successful"; } } if (isset($_POST["saveTheExam"])) { $examName = $_POST["examName"]; $startDateTime = $duration = ""; if (isset($_POST["year"])) { $d = $_POST["year"] . "-" . $_POST["month"] . "-" . $_POST["day"] . " " . $_POST["hour"] . ":" . $_POST["minute"]; $startDateTime = date("Y-m-d H:i:s", strtotime($d)); //echo $startDateTime; }
<?php $examId = $_GET["examId"]; $examDetail = selectExamInfo($examId); $questionSet = selectAllQuestionOf($examId); echo '<div id="examTitle"> <h3>' . $examDetail["examName"] . '</h3>'; $examinerInfo = selectUserInfo($examDetail["examinerId"]); echo '<h4> <span>Exam Id : <span id="examId">' . $examId . '</span> , </span> <span><u>Exam By : ' . $examinerInfo["name"] . '</u></span> </h4> <h5>(Tick The Correct Answers, Your answer will save automatically)</h5> </div>'; echo '<br>'; $start = 0; $end = count($questionSet); for ($index = $start; $index < $end; $index++) { $order = $index + 1; $question = selectQuestionDetail($questionSet[$index]["questionId"]); echo '<div class="question">' . $order . ') ' . htmlspecialchars($question["question"], ENT_QUOTES, ini_get("default_charset")) . '</div>'; echo '<br>'; $options = selectAllOptionsOf($questionSet[$index]["questionId"]); foreach ($options as $op) { if (isSelected($_SESSION["currentUser"], $examId, $question["questionId"], htmlspecialchars($op["mcqOption"], ENT_QUOTES, ini_get("default_charset")))) { echo '<label class="mcqOptions"><input type="checkbox" class="clickOptions" onchange="submitAnswer()" name="' . $question["questionId"] . '" value="' . htmlspecialchars($op["mcqOption"], ENT_QUOTES, ini_get("default_charset")) . '" checked> ' . htmlspecialchars($op["mcqOption"], ENT_QUOTES, ini_get("default_charset")) . '</label>'; } else { echo '<label class="mcqOptions"><input type="checkbox" class="clickOptions" onchange="submitAnswer()" name="' . $question["questionId"] . '" value="' . htmlspecialchars($op["mcqOption"], ENT_QUOTES, ini_get("default_charset")) . '"> ' . htmlspecialchars($op["mcqOption"], ENT_QUOTES, ini_get("default_charset")) . '</label>'; } echo '<br>'; }
<br> <div id="allResult"> <table id ="examList" class="table table-hover table-responsive"> <tr> <th>Examinee Name</th> <th>Institution Id</th> <th>Acquired Mark</th> <th>Option 1</th> </tr> <?php $examineeList = selectAllExamineeOf($_GET["examId"]); if ($examineeList) { foreach ($examineeList as $examinee) { $examineeInfo = selectUserInfo($examinee["examineeId"]); ?> <tr> <td><?php echo $examineeInfo["name"]; ?> </td> <td><?php echo $examinee["institutionId"]; ?> </td> <td><?php echo getAcquiredMarks($_GET["examId"], $examinee["examineeId"]); ?> </td> <td><a href="#">Detail</a></td>