Sample text

This commit is contained in:
2023-08-19 21:15:47 +03:00
parent 611e213592
commit d4b7a03802
8 changed files with 126 additions and 17 deletions

View File

@ -4,12 +4,8 @@ require_once("_db.php"); //("api/_db.php");
// Check if request was to specified file
function ThisFileIsRequested ($fullpath) {
return substr($fullpath, -strlen($_SERVER["SCRIPT_NAME"])) === $_SERVER["SCRIPT_NAME"];
}
session_start();
//session_start();
// This ^ should be placed at login stage
$LOGGED_IN = false;
@ -25,6 +21,18 @@ if (isset($_SESSION["userid"])) {
die("user id used in session does not exist");
}
$LOGGED_IN = true;
} else {
// ATTENTION: idk will this work, but this can be theoretically unsafe or cause fault
if (session_status()) {
session_unset();
session_destroy();
}
if (isset($_COOKIE["PHPSESSID"])) {
unset($_COOKIE["PHPSESSID"]);
setcookie("PHPSESSID", "", time() - 3600, "/");
}
}
?>