} $filter_full = filter_input(INPUT_POST, 'full_button'); $filter_past = filter_input(INPUT_POST, 'past_button'); if (!empty($filter_full)) { $_SESSION['filter_full'] = !$_SESSION['filter_full']; } if (!empty($filter_past)) { $_SESSION['filter_past'] = !$_SESSION['filter_past']; } $full_num = $_SESSION['filter_full'] ? 1 : 0; $past_num = $_SESSION['filter_past'] ? 1 : 0; $selList = []; foreach ($testSelectedList as $test) { array_push($selList, $test['test_id'] . ":" . $test['test_time_id']); } $testList = get_test_list($user->usr_id, $sort_by, $sort_order, $full_num, $past_num); include "view.php"; break; default: echo 'Unknown account action: ' . $action; break; } verify_logged_in(); $action = filter_input(INPUT_GET, 'action'); if (isset($action) and $action == "logout") { if (isset($_SESSION['prev_usr_id'])) { $_SESSION['user'] = User::getUserByUsrId($_SESSION['prev_usr_id']); $_SESSION['prev_usr_id'] = NULL; header("Location: ../admin/index.php"); } else { session_destroy();
<?php require_once "../../util/main.php"; require_once "../../model/teacher_db.php"; $testTypes = get_test_types(); $rooms = get_rooms(); $action = strtolower(filter_input(INPUT_POST, 'action')); if ($action == NULL) { $action = strtolower(filter_input(INPUT_GET, 'action')); if ($action == NULL) { $action = 'list_tests'; } } switch ($action) { case 'list_tests': $testList = get_test_list($user->usr_id, 0, 0, 0, 0); break; case 'add_test': $error_msg = ''; $choice = filter_input(INPUT_POST, 'choice'); $test_name = filter_input(INPUT_POST, 'test_name'); $date = filter_input(INPUT_POST, 'date'); $one_three = intval(filter_input(INPUT_POST, 'one_three')); $four_six = intval(filter_input(INPUT_POST, 'four_six')); $seven_nine = intval(filter_input(INPUT_POST, 'seven_nine')); $ten_twelve = intval(filter_input(INPUT_POST, 'ten_twelve')); $thirteen_fifteen = intval(filter_input(INPUT_POST, 'thirteen_fifteen')); $sixteen_eighteen = intval(filter_input(INPUT_POST, 'sixteen_eighteen')); $nineteen_twentyone = intval(filter_input(INPUT_POST, 'nineteen_twentyone')); $twentytwo_twentyfour = intval(filter_input(INPUT_POST, 'twentytwo_twentyfour')); $twentyfive_twentyseven = intval(filter_input(INPUT_POST, 'twentyfive_twentyseven'));
$action = strtolower(filter_input(INPUT_POST, 'action')); if ($action == NULL) { $action = strtolower(filter_input(INPUT_GET, 'action')); if ($action == NULL) { $action = 'list_tests'; } } switch ($action) { case 'delete_course': $test_id = filter_input(INPUT_GET, 'test_id'); delete_course($test_id); $testList = get_test_list(); include "view.php"; break; case 'list_tests': $testList = get_test_list(); break; default: echo 'Unknown account action: ' . $action; break; } verify_logged_in(); $action = filter_input(INPUT_GET, 'action'); if (isset($action) and $action == "logout") { if (isset($_SESSION['prev_usr_id'])) { $_SESSION['user'] = User::getUserByUsrId($_SESSION['prev_usr_id']); $_SESSION['prev_usr_id'] = NULL; header("Location: ../admin/index.php"); } else { session_destroy(); header("Location: ../index.php");