I have a login page that uses email and password and also an admin checkbox. i have already created the coding for email and password login but not the coding if checkbox is checked it will direct admin.php coz well im not sure how. normal users will be directed to home.php
my login code:
<?php
if (isset($_POST['submit']))
{
$email = mysql_real_escape_string(isset($_POST['email']) ? stripslashes($_POST['email']) : false);
$password = mysql_real_escape_string(isset($_POST['password']) ? stripslashes($_POST['password']) : false);
if ($email&&$password)
{
require "dbase.php";
$query = mysql_query("SELECT * FROM signup WHERE email LIKE '$email'");
$numrows = mysql_num_rows($query);
if (1 == $numrows)
{
$rows = mysql_fetch_assoc($query);
if ($email==$rows['email'] && $password==$rows['password'])
{
$_SESSION['email']=$rows['email'];
$_SESSION['name']=$rows['name'];
header("Location: home.php");
}
else
{
echo "Incorrect Password";
header("Location: LogIn.php");
}
}
else
{
echo ('<script type="text/javascript">alert("The Email Does Not Exist In Database");</script>');
header("Location: LogIn.php");
}
}
else
{
echo ('<script type="text/javascript">alert("Please Enter An Email and/or Password");</script>');
header("Location: LogIn.php");
}
}
exit();
?>
thanks in advance.
ps: btw a side problem if you guys can help me out. the else statements won't run. even the incorrect and email does not exist. thanks in advance if you guys help me with this problem.