Jump to content

3 tier system


akki85

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
Link to comment
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"}

Link to comment
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.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.