cheechm Posted October 5, 2007 Share Posted October 5, 2007 Hello, I was wondering what the best way of doing permissions would be. IE I have this in my config.php file: define("ADMIN", 9); define("REVIEWER", 0); define("EDITOR", 0); define("USER", 1); define("GUEST", 0); How would I be able to set permissions for each page? Also if I want to edit them from a user interface would it be best to store in a MySQL table? Can you point me to tutorials? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/72004-solved-best-way-for-permissions/ Share on other sites More sharing options...
BlueSkyIS Posted October 5, 2007 Share Posted October 5, 2007 How would I be able to set permissions for each page? Also if I want to edit them from a user interface would it be best to store in a MySQL table? you'll want to use SESSIONS. have the user log in using a user name and password stored in a table along with the user level, 'permissions', for that user. when the user logs in, set a session variable defining that user's permissions, ala $_SESSION['permissions'] = 1; when the user visits a protected page, check the value set for that user's permissions: if ($_SESSION['permissions'] < 1) { echo "You don't have permission."; exit; } else { echo "You DO have permission."; // continue processing } Quote Link to comment https://forums.phpfreaks.com/topic/72004-solved-best-way-for-permissions/#findComment-362731 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.