Forum Moderators: coopster

Message Too Old, No Replies

Login script with different access levels

         

sammy111

9:13 am on Mar 28, 2006 (gmt 0)

10+ Year Member



Hi all,
I would like to create a log in script with different user access levels: System admin, manager and staff.
I currently have a log in script in place, but this does not facilitate the different user access levels. If any one can point me in the right direction of where I could get help with writing such a script.

regards,
sam

omoutop

10:05 am on Mar 28, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Easy with minor modifications. First you need an admin page that can Edit Users. Make a plan for each User Level you want to have (lets say level_1=admin, ... level_9=guest) and edit your user accounts

In your menus you need to have various ifs/cases, something like:

if (user_level==1)
{
echo "Add New User<br>";
echo "Edit User";
}
else
{
echo "Edit profile":
}

In your [New User? Register Here!] script, just add a hidden field with whatever user_level you want to assign new members with.

In your check_login script, just grab the user_level from your db and if login is succesfull, redirect user to whatever pages are appropriate for his user_access_level.

And you are set :)

Habtom

1:01 pm on Mar 28, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



adding to omoutop's response . . . You can redirect them to the same page but hidden values where you can hide and show options, and protect every page with codes like if ($user = 9) { redirect to his/her homepage} else { show }

You can play around with the alternatives, but you can easily keep it simple and neat.

Habtom

le_gber

12:19 pm on Mar 29, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



sammy111

try Google [google.com] for complete tutorials.

Hope this helps