I am creating a website where there are three different levels of access
- 0 = normal
- 1 = staff
- 2 = admin
In the login form, I managed to check if the password(SHA1) matches the one in the database (which is encrypted), but didn't check the user id.
When the user or staff / admin are registered, their details are stored into separate tables which have more details( Name, DateOfBirth, ... ).
Questions
how would I implement this in my code?
$result = mysql_query( $qs ) or die( mysql_error() ); while( $row = mysql_fetch_array( $result ) ){ $stored_password = $row['Password']; if( $stored_password == sha1( $pw ) ){ $_SESSION['Status'] = $row['Status']; if( $_SESSION['Status'] == 0 ){ echo "<h1>User Menu Loading...</h1>"; echo"<META HTTP-EQUIV='Refresh' Content='1;URL=http://***/'>"; }else{ echo "<h1>Incorrect Password.</h1>"; echo"<META HTTP-EQUIV='Refresh' Content='1;URL=http://**/login.php'>"; } }Is there a way all these three types of users can login via the login page and can retrieve the data from two different tables?
I have tried many ways but keep getting a blank screen or it says
incorrect password
even though the password is correct.
variables
$un = $_POST['User_ID'];
$sf = $_POST['Staff_ID'];
$pw = $_POST['Password'];
$st = $_POST['Status'];
if not then I think I should create separate login areas.
thank you ( I am currently changing mysql to mysqli )
EDIT
ADDED MOST RECENT TRY OF $qs
$qs="SELECT Cadets.Cadet_ID, Cadets.Password, Cadets.Status,
Staff.Staff_ID, Staff.Password, Staff.Status,
FROM Cadets, Staff
WHERE Cadets.Cadet_ID ='$un' AND Staff.Staff_ID = '$sf'";