I have a login register system, if the user creates an account then all the pages which i have included the below code on pages which are protected:
if(!$user->is_logged_in()){ header('Location: login.php');
This code checks to see if the user has logged in, and if so they will be able to access the page.
I have added a new column to the mysqli database called "priv" this is a boolean field default being '0', any user which has the bool set to '1' they will be able to access the admin pages.
I have attempted using a query select in an if statement, like this :
if(mysqli_query($conn,"SELECT * FROM members WHERE priv == 1")){ header('Location: login.php'); }
Im not sure if this would be the right way of doing this, or if there is a more secure and working way i can get this to work, Thanks for any help
Aucun commentaire:
Enregistrer un commentaire