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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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