im trying to create a login screen that has 2 conditions. it checks if the user in the database has a 'is_admin' value of 1 or 0. 1 being the administrator and 0 being a normal user. in the 2 if statements it either redirects them to a admin page or a user page. my problem is its not going into the 'if' statements...i think
note the variable password or pw has nothing to do with my code yet, i will implement it later.
pls help here is my code:
<HTML>
<HEAD>
<TITLE>Protocol Login</TITLE>
<meta http-equiv="Content-Type" content="text/html; charset=">
</HEAD>
<BODY BGCOLOR="#FFFFFF">
<p> </p>
<p> </p>
<?
if($_POST['Submit'] == 'Login')
{
//CONNECTION TO PROTOCOL DATABASE:
mysql_connect("localhost", "root")
or die("Could not connect:" . mysql_error());
mysql_select_db("prot") or die("connection failed");
$username = $POST['username_form'];
$password = $POST['pw_form'];
$access_numq = mysql_query("SELECT is_admin FROM identity WHERE identity.username = '$username'");
$row = mysql_fetch_array($access_numq);
$access_num = $row['id_admin'];
// if 'if_admin' is a 1 then load admin page(interface.php)
if($access_num == 1)
{
//FULL ACCESS
echo '<p><a href="interface.php">Click here to continue</a></p>';
}
// if 'if_admin' is a 0 then load user page (interface2.php)
if($access_num == 0)
{
//LIMITED ACCESS
echo '<p><a href="interface2.php">Click here to continue</a></p>';
}
else
echo 'not in db';
//CLOSE DATABASE
mysql_close();
}
?>
<form method="post" action="login.php">
<p>
<input type="text" name="username_form">
<font face="Arial, Helvetica, sans-serif"><b>Enter your username</b></font></p>
<p>
<input type="text" name="pw_form">
<font face="Arial, Helvetica, sans-serif"><b>Enter your password</b></font><b><font face="Verdana, Arial, Helvetica, sans-serif">
</font></b></p>
<p> </p>
<p>
<input type="submit" name="Submit" value="Login">
</p>
</form>
</BODY>
</HTML>