Jump to content


Photo

3 tier system


  • Please log in to reply
2 replies to this topic

#1 akki85

akki85
  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 22 March 2006 - 10:13 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 convinceme

convinceme
  • Members
  • PipPip
  • Member
  • 16 posts

Posted 22 March 2006 - 11:43 AM

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



#3 akki85

akki85
  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 22 March 2006 - 03:39 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.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users