Jump to content

Archived

This topic is now archived and is closed to further replies.

akki85

3 tier system

Recommended Posts

m making a student database using php & mysql. i want to make a 3 tier system such that the users get the least priority i.e. they should only have the access to view the information. then the teachers should be at the second level such that they have the access to update the database and make few changes and at last the HOD should get the top priority to add or delete tables etc... i am new at this..plz help

Share this post


Link to post
Share on other sites
ok, within your mySQL database you'll want to create a 'users' table.

userid, username, passwordforename, surname, auth_level (for example).

You input the users into the table, and assign them their auth_level accordingly (1, 2 or 3).
Then, within your script to process their logging on to the system, have it pick their details from the table, including their auth_level and set it into the session variables.

Then if you have "secret" pages, you simple have something like this;

if($_SESSION['auth_level'] >= "2") { echo "let them see it"} else { echo "Keep them out"}

Share this post


Link to post
Share on other sites

if i am not getting it wrong then only if the user is having level > 1 he'll be allowed to goto the page that's used for updating the database?
thanx a lot for the help.

Share this post


Link to post
Share on other sites
you can set it up however you like...

[code]if($auth_level>1) { echo "secure stuff"} else {echo "you dont have permission!"}[/code]

Thats the way i would (and have) done things.


I have an intranet site which has a standard appearance, with options to carry out certain functions etc, but if $auth_level is greater than 1 (one being standard user auth_level) then i display additional buttons etc.

Works well.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.