prepare("SELECT id FROM users WHERE id = ?"); $s->bind_param("s", $_SESSION["userid"]); $s->execute(); if (!(bool)$s->get_result()->fetch_assoc()) { // If not, then destroy session AUTH_EndSession(); die("user id used in session does not exist"); } $LOGGED_IN = true; $THIS_USER = $_SESSION["userid"]; } elseif (session_status() === PHP_SESSION_DISABLED) { // If sessions are disabled die("ERROR: please enable sessions in php config"); } // HACK if ($Config["debug"] && isset($_REQUEST["debug"])) { // If there are not any session and debug mode is on // ATTENTION: FOR DEBUG PURPOSES ONLY! if ($_REQUEST["debug"] == "drop") { AUTH_EndSession(); die("session discarded"); } $_SESSION["userid"] = intval($_REQUEST["debug"]); print_r(["created_session" => $_SESSION]); die(); } ?>