Продолжил делать API для манипуляции с юзерами
This commit is contained in:
@ -2,6 +2,13 @@
|
||||
|
||||
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();
|
||||
|
||||
$LOGGED_IN = false;
|
||||
@ -11,7 +18,7 @@ if (isset($_SESSION["userid"])) {
|
||||
$s = $db->prepare("SELECT * FROM users WHERE id = ?");
|
||||
$s->bind_param("s", $_SESSION["userid"]);
|
||||
$s->execute();
|
||||
if (!(bool)$s->get_result()->fetch_assoc()) {
|
||||
if (!(bool)$s->get_result()->fetch_assoc()) { // If not, then destroy session
|
||||
session_unset();
|
||||
session_destroy();
|
||||
echo "user id does not exist";
|
||||
|
Reference in New Issue
Block a user