prepare("SELECT * FROM users WHERE id = ?"); $s->bind_param("s", $_SESSION["userid"]); $s->execute(); if (!(bool)$s->get_result()->fetch_assoc()) { // If not, then destroy session EndSession(); echo "user id does not exist"; die("user id used in session does not exist"); } $LOGGED_IN = true; } else { if (session_status()) { EndSession(); } } ?>