// allows user to start all over again } else { if (isset($_SESSION['courseId']) && !isset($_GET['resume'])) { $questionsSet = getTestQuestions($_SESSION['courseId'], $numQuestions); if (empty($questionsSet)) { redirect('resource/error'); exit; } $jsonQuestions = formatQuestionsAsJson($questionsSet); if (($testId = createTest($jsonQuestions)) != false) { $_SESSION['active_test_id'] = $testId; redirect('taketest'); } } elseif (isset($_GET['resume'])) { //unset($_SESSION['active_test_id']); $testId = numDecrypt($_GET['resume']); // redeclare active test id session $_SESSION['active_test_id'] = $testId; $_SESSION['courseId'] = getTestById($testId)['course_id']; //perform queries upon resume $userId = $_SESSION['user_id']; $startedAt = date('Y-m-d H:i:s'); $sql = "UPDATE users SET paused_tests = paused_tests-1 WHERE id = '{$userId}'"; $sql2 = "UPDATE test_info SET paused = 0, started_at= '{$startedAt}' WHERE test_id = '{$testId}'"; if (mysql_query($sql) && mysql_query($sql2)) { redirect('taketest'); } } /*elseif(isset($_GET['resume']) && !isset($_SESSION['active_test_id'])) { $testId = numDecrypt($_GET['resume']);
<?php session_start(); require_once '../core/init.php'; auth(); //protects this page against unauthenticated users if (isset($_SESSION['active_test_id'])) { $testId = $_SESSION['active_test_id']; } elseif (isset($_GET['tid'])) { $testId = numDecrypt($_GET['tid']); } if (isset($_GET['tid']) && isset($_SESSION['active_test_id'])) { unset($_SESSION['active_test_id']); } list($questionId, $testData) = getQuestionFromJson($testId); //$department = getDepartment($deptId)[0]; //$course = getCourse($courseId)[0]; //print_array($_SESSION);die(); ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags --> <title>Answer Review page</title> <!-- Bootstrap --> <link href="css/bootstrap.min.css" rel="stylesheet">
<?php session_start(); require_once '../core/init.php'; auth(); // protects this page against unauthenticated users if (isset($_POST['college_id'])) { $_SESSION['college_id'] = $_POST['college_id']; } elseif (isset($_GET['collegeid'])) { $collegeId = numDecrypt($_GET['collegeid']); $_SESSION['college_id'] = $collegeId; } $data = getDepartmentWithCourses($_SESSION['college_id']); $college = getCollege($_SESSION['college_id'])[0]; ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags --> <title>Welcome to the departments page</title> <!-- Bootstrap --> <link href="css/bootstrap.min.css" rel="stylesheet"> <link rel="stylesheet" type="text/css" href="css/department.css"> </head> <body>
function deleteTest($index) { $delTestId = numDecrypt($index); if (deleteRecord('test_info', 'test_id', $delTestId)) { $sqlRun = mysql_query("UPDATE users SET tests_taken= tests_taken-1 WHERE id = '{$_SESSION['user_id']}'"); if ($sqlRun) { return true; } } }
session_start(); require_once '../core/init.php'; auth(); // protects this page against unauthenticated users if (isset($_POST['course'], $_POST['deptId'])) { // initialise variables for the page $courseId = $_POST['course']; $_SESSION['deptId'] = $_POST['deptId']; $_SESSION['courseId'] = $courseId; //fetch department for display $department = getDepartment($_SESSION['deptId'])[0]; // } elseif (isset($_GET['courseid'])) { // initialize variables for the page $courseId = numDecrypt($_GET['courseid']); $_SESSION['courseId'] = $courseId; } //$_SESSION['start'] = "started"; // fetch course for display $course = getCourse($_SESSION['courseId'])[0]; //print_array($_SESSION); die(); ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge">