function forceLogin() { global $DOEQS_URL; session_total_reset(); alert('Oops, you need to log in to access <i>' . basename($_SERVER['REQUEST_URI']) . '</i>.', -1, 'login.php'); $_SESSION['login_redirect_back'] = $_SERVER['REQUEST_URI']; header('Location: ' . $DOEQS_URL . 'login.php'); die; }
<?php define('ROOT_PATH', ''); require_once ROOT_PATH . 'functions.php'; restrictAccess('a'); //xuca //separate face of this page: "Are you sure?" //echo $_SESSION["admin-ver"]=genRandStr(); //if($_POST["admin-ver"]===$_SESSION["admin-ver"]) //for particularly dangerous ones "Reenter password to do this action" echo '<b style="color:green">'; if (csrfVerify()) { if (isset($_POST["logout"])) { session_total_reset(); die("logged out"); } elseif (isset($_POST["truncQs"])) { DB::query("TRUNCATE TABLE questions"); alert("TRUNCATE TABLE executed.<br><br>", 1); } elseif (isset($_POST["timesViewed"])) { DB::query("UPDATE questions SET TimesViewed=0"); alert("All questions' times-viewed-s zeroed.<br><br>", 1); } elseif (isset($_POST["markBad"])) { DB::query("UPDATE questions SET MarkBad=0"); alert("All questions' marked-as-bad-s zeroed.<br><br>", 1); } elseif (isset($_POST["optimizeTables"])) { DB::query("OPTIMIZE TABLE users,questions"); alert("OPTIMIZE TABLE executed<br><br>", 1); } elseif (isset($_POST["qInt"])) { //Subject in {0,1,2,3,4} //isB and isSA in {0,1} //Question not blank or null