0
No idea how to write this PHP statement pls help
If session role not "superuser" and "admin" then redirect
1 Answer
0
You need to assign the session role to variable e.g $role or get the user role from the database with SELECT statement.
PS. For test you can specify role before the if code:
This is one of the examples
$role = 'admin'; // change to user and you should see a message with no access.
if($role != 'superuser' && $role != 'admin') {
echo 'You have no access to this page!';
} else {
echo 'Hello '.$role.'.';
// your code
}