Login Trouble

admin

Administrator
Staff member
Basically, here is my situation. I have a login page that allows both students and 1 administrator to enter the main site.
When I log in currently, it takes me to the main page, only if i enter the correct username and password (which is what I wanted).
BUT, now I am having trouble creating my IF Statement that is supposed to take the Administrator to his own Main Page, based on the Yes /No value for the Administrator field in the MS Access database (kinda if the Administrator field is Yes, then allow entry for the Administrator, other deny it for everyone else). When the Students login, it takes them to their own Main Page, so that the Administrator field would be False or set to No.
Not sure if anyone can follow this, but I will include my code too for a better understanding.



$db=odbc_connect("2001Counsell", "username", "password");
$result=odbc_exec($db, "SELECT * FROM tblLogin");
$userLocated=false;
$instruction="";

while($myrow=odbc_fetch_row($result) && (userLocated != "true"))
{
if ($username==odbc_result($result, "UserName") && ($password==odbc_result($result, "Password") && ($administrator==odbc_result($result, "Administrator"))))
{
$userLocated="true";
}

}

if ($userLocated=="true")
{
if ($PHPSESSID)
{
session_save_path("c:/");
session_start();
session_register('currentuser');
$currentuser=$username;

}

header ("Location: <!-- m --><a class="postlink" href="http://localhost/mainprof.html?currentuser=$username">http://localhost/mainprof.html?currentuser=$username</a><!-- m -->");
exit;
}
else
{
$instruction="Invalid Login!";
}
}
?>
 
Back
Top