akki85 Posted March 22, 2006 Share Posted March 22, 2006 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 Quote Link to comment Share on other sites More sharing options...
wisewood Posted March 22, 2006 Share Posted March 22, 2006 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"} Quote Link to comment Share on other sites More sharing options...
akki85 Posted March 22, 2006 Author Share Posted March 22, 2006 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. Quote Link to comment Share on other sites More sharing options...
wisewood Posted March 22, 2006 Share Posted March 22, 2006 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.