Jump to content

Archived

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

akki85

3 tier system

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

Share this post


Link to post
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

Share this post


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

Share this post


Link to post
Share on other sites

×

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.