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 https://forums.phpfreaks.com/topic/5488-3-tier-system/ Share on other sites More sharing options...
convinceme Posted March 22, 2006 Share Posted March 22, 2006 wel what you can do is in your user authentication database create a column for level in which you can give people a specific user level which determines their priority and whenever user is logged in you check for his/her user level. i hope this helpsthe example below is just to give u a lil picture of how to query ur mysql database[code]$sql = "SELECT password,level from users where username='$user'";$query = mysql_query($sql);$numrows = mysql_num_rows($query);if ($numrows > 0) { $row = mysql_fetch_array($query); $u_passwd = $row['password']; $u_level = $row['level']; if ($password == $u_passwd) { if ($u_level == "1") { echo "Hello User"; } if ($u_level == "2") { echo "Hello Teacher"; } if ($u_level == "3") { echo "Hello HOD"; } }}[/code]u_passwd = password stored in databaseu_level = value of level stored in database as 1,2,3 this can be anything you want thoughpassword = password you have typed in the formuser = username you have typed in the formI hope that helps Quote Link to comment https://forums.phpfreaks.com/topic/5488-3-tier-system/#findComment-19614 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 https://forums.phpfreaks.com/topic/5488-3-tier-system/#findComment-19675 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.