Log in

View Full Version : PHP Login Admin Features



SChaput
11-11-2008, 05:29 PM
I have implemented the login script found here:
http://www.evolt.org/PHP-Login-System-with-Admin-Features
It works very well allowing only the admin to view the admin control panel. However, i want to be able to specify different user level's besides 1, and 9. For instance, i want a user to be able to access a certain page only if there user level is set to 5. Perhaps this question to too broad, and lacks posted code, but i am really not sure where to even begin in decoding the user level codes.
Help is greatly appreciated.

BLiZZaRD
11-11-2008, 06:25 PM
find this:



define("ADMIN_NAME", "admin");
define("GUEST_NAME", "Guest");
define("ADMIN_LEVEL", 9);
define("USER_LEVEL", 1);
define("GUEST_LEVEL", 0);


add your new user:



define("ADMIN_NAME", "admin");
define("GUEST_NAME", "Guest");
define("POWER_NAME", "Power User");
define("ADMIN_LEVEL", 9);
define("USER_LEVEL", 1);
define("GUEST_LEVEL", 0);
define("POWER_LEVEL", 5);


That should get you started :D

SChaput
11-11-2008, 07:31 PM
I was able to find this in my code, however i do not want to specify the 'power_user' in my code. As it is now, in my admin control panel i can change the level of a user. I want to change a user to level to 5. And on another page if they are 5 or greater, they are able to view the contents.

boogyman
11-11-2008, 08:36 PM
By looking at Blizz's post, it appears that the user level is defined within some function / class.

There are ways of referencing a function on a different page, by using commands within the specific page you wish to reference to.

The only other way would be to use a database, however you would still require the function / class to access the database and validate the users appropriate permissions.

BLiZZaRD
11-11-2008, 08:58 PM
Yup,. and all instructions are listed on the page the OP linked too. Just have to read ;)