Fix the bug where every user is an admin

This commit is contained in:
SilicaAndPina 2021-07-10 18:24:09 +12:00
parent 964a4e879c
commit 0e571700fa
3 changed files with 6 additions and 2 deletions

View file

@ -1,4 +1,5 @@
<?php <?php
session_start();
include("config.php"); include("config.php");
// Handle logout // Handle logout

View file

@ -272,7 +272,7 @@ function get_admin(int $userid)
$stmt->bind_param("i", $userid); $stmt->bind_param("i", $userid);
$stmt->execute(); $stmt->execute();
$result = $stmt->get_result(); $result = $stmt->get_result();
return $result->fetch_row()[0]; return $result->fetch_row()[0] === "YES";
} }
@ -285,7 +285,7 @@ function get_mod(int $userid)
$stmt->bind_param("i", $userid); $stmt->bind_param("i", $userid);
$stmt->execute(); $stmt->execute();
$result = $stmt->get_result(); $result = $stmt->get_result();
return $result->fetch_row()[0]; return $result->fetch_row()[0] === "YES";
} }

View file

@ -1,4 +1,5 @@
<?php <?php
session_start();
include('common.php'); include('common.php');
include('crosserver.php'); include('crosserver.php');
include('config.php'); include('config.php');
@ -9,6 +10,8 @@ if(isset($_GET["LOGOUT"]))
{ {
if($_GET["LOGOUT"] == 1) if($_GET["LOGOUT"] == 1)
{ {
$_SESSION['LOGGED_IN'] = "NO";
session_destroy(); session_destroy();
} }
} }