Okay so I need some help with my login system. I'm trying to get it to either redirect to the login page or a separate download page depending on what "rank" the user has in the mysql database (i set the Admin value to an int. with the default 0 (which I intend to make user value) and the admin value 1 which I can change and update in the admin page). So I wrote out this code:
and no matter if the user is 1 or 0 for the Admin value in the database it will either only redirect to the admin page or the download page, ie. I set user agenator to 1 and I set user scott to 0 but they both will go to "form.html" I need to know how to fix this so that obviously the right person will get redirected to the right page, so does anyone know how to do this?
Thanks for your help
PHP:
<?php
include 'config.php';
include 'opendb.php';
mysql_select_db($dbname) or die(mysql_error());
$email = $_POST['email'];
$password = $_POST['password'];
$admin = "select Admin FROM information where email='$email' and password='$password'";
$query = "select*from information where email='$email' and password='$password'";
$result = mysql_query($query);
$adminresult = mysql_query($admin);
if (mysql_num_rows($result) != 1)
{
$error = 'Bad Login';
include 'mainpage.html';
}
elseif (mysql_fetch_object($adminresult) == 1){
include "adminpage.html";
}else{
include "form.html";
}
include 'closedb.php';
?>
Thanks for your help