I have a Mysql data base with say 3 login fields username, password and admin ( which is level 0 or 1
if the user logs in i would like a admin user to goto a and a Guest to go to b area this is what i have so far ???
// Create query
$q = "SELECT * FROM users WHERE USERNAME = '".$USERNAME."' AND PASSWORD = '".md5($PASSWORD)."'and ADMIN= '".$ADMIN."' LIMIT 1";
// Run query
$r = mysql_query($q);
if ( $obj = @mysql_fetch_object($r) )
{
// Login good, create session variables
$_SESSION["valid_id"] = $obj->id;
$_SESSION["valid_user"] = $_POST["username"];
$_SESSION["valid_time"] = time();
$_SESSION["valid_admin"] = "$admin";
// Redirect to member page
Header("Location: members1.php");
}
else
{
// Login not successful
die("Sorry, could not log you in. Wrong login information.<a href=\"index.php\">PLEASE Sign Back in</a>");
}
}
else
{
//If all went right the Web form appears and users can log in
echo "<form action=\"?op=login\" method=\"POST\">";
echo "Username: <input name=\"username\" size=\"15\"><br />";
echo "Password: <input type=\"password\" name=\"password\" size=\"15\"><br />";
echo "<input type=\"submit\" value=\"Login\">";
echo "</form>";
}