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
https://forums.phpfreaks.com/topic/5488-3-tier-system/
Share on other sites

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 helps
the 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 database
u_level = value of level stored in database as 1,2,3 this can be anything you want though
password = password you have typed in the form
user = username you have typed in the form

I hope that helps

Link to comment
https://forums.phpfreaks.com/topic/5488-3-tier-system/#findComment-19614
Share on other sites

Archived

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

×
×
  • 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.