I have a page for users named game.php, where they can update their profile etc. So when the admin logs in, they can still access game.php but I do not want them to do so. How do I prevent it?
I have 2 different log in page, 1 for normal users (logreg.php), 1 for admin (admin.php)
This is my game.php codes, where they restrict all users so I even if I am a normal user, it redirects me back to logreg.php, when I am supposed to be able to access it.
The status of the user will be "gamer" - a normal user OR "admin" - for admin log in.
<?php
session_start();
ob_start();
If (!isset($_SESSION["username"]['status'])){
$_SESSION['username'] = $username;
$_SESSION['status'] = 'admin';
header("Location:logreg.php");
}
else {
$username = $_SESSION['username'];
}
?
Thanks in advance!!!!
In your if
, you are checking the value of $_SESSION["username"]['status']
but in your code you are setting $_SESSION["username"]
and $_SESSION['status']
. You probably meant the if
to read:
if (!isset($_SESSION["username"], $_SESSION['status'])) {
to check that both $_SESSION
variables were set.
<?php
session_start();
ob_start();
If (isset($_SESSION["username"]['status'] && isset($_SESSION["username"]['status']=="admin")){
header("Location:logreg.php");
}
?>
try this code :)
Firebase Cloud Functions: PubSub, "res.on is not a function"
TypeError: Cannot read properties of undefined (reading 'createMessageComponentCollector')
I'm working to add some functions to an user management class I've made and that I'm using in various projectI've decided to use some static functions of a class to check, verify and delete the $_SESSION when user login, are logged in and when logout
In the below code, I can't figure out where the {getFirebase} argument is coming from that is being passed in to the line that reads
I am trying to learn BootstrapI have the code referenced below