Hierarchical login panel in PHP

Hi! I am trying to find a hint about Hierarchical login panel in PHP which authenticates the login user and gives rights as per his position in hierarchy like follows:

Administrator-> Manager -> Business Developer
Programmer -> Marketing Executive

Where login rights are descending as per user level. Can anyone give me a slightest idea how can I achieve this??

Assign each user a role (can be an extra field in the user’s login table) and restrict access to areas of program to users depending on their roles.

You can give each user a numerical access level when the user is registered. Then on the top of every web page, check if the user is logged in and if their access level is at the required level for that page before running the rest of the script on that page.

Yeh I can do that.
Like Administrator status=1
Administrator Panel
But how can I get this status value??Can I use sessions??
I really dont know how to put this in code.

You can store the users’ access level in your users database table. When the user logs in, get the access level for the user from the table and store it in a session variable. Then at the top of every web page you check if the access level session variable exists and if it has the correct value for the web page.

For example


if(!isset($_SESSION['access_level']) || $_SESSION['access_level'] != 3) {
     echo '<p>You are an unauthorised user</p>';


You could also incorporate the above if block in the if statement that checks if the user is logged in.

Thanks for ur reply Angel!
I will try this code right now.