I want to create an admin page using SQL & PHP

mysql

#1

Hide Copy Code
Hello! I want to create a page that is only accessible for Admin users, on my SQL tables I created a table called 'users' and created a column called 'isAdmin' and if the user is an admin, I entered a 1 instead of a 0. Additionally, in the table there is a 'u_id' which is used to show if a user is logged in or not. I would like to use both these tables to create a page that is only accessible if you're logged in and an admin user.
Here is my code:

<?php
if (isset($_SESSION['u_id'] && ['isAdmin! = 1'])) {
	
} else {
    header("Location: ../loginsystem/index.php");
} 
?>

But it doesnt work, please can someone help.


#2

Do you have any error messages showing?


#3

What do you mean by

Is it supposed to be
$_SESSION['isAdmin'] != 1
?


#5

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.