Jump to content


Photo

3 tier system


  • Please log in to reply
3 replies to this topic

#1 akki85

akki85
  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 22 March 2006 - 10:09 AM

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

#2 wisewood

wisewood
  • Members
  • PipPipPip
  • Advanced Member
  • 226 posts
  • LocationRotherham, England

Posted 22 March 2006 - 11:39 AM

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"}


wisewood: proven fact, I am both wise, and wooden.

#3 akki85

akki85
  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 22 March 2006 - 03:41 PM


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.

#4 wisewood

wisewood
  • Members
  • PipPipPip
  • Advanced Member
  • 226 posts
  • LocationRotherham, England

Posted 22 March 2006 - 04:02 PM

you can set it up however you like...

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

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.
wisewood: proven fact, I am both wise, and wooden.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users