I am having a bit of trouble with getting my redirection to work..for some reason no matter what login I use, I keep getting sent to the user.php page...here is the code I am working with...for the life of me, I can't see what I'm missing...thanks
<?php
include("db_connect.php");
$username = $POST['user'];
$password = $POST['pass'];
if (!$POST['pass'] && !$POST['user']) {
?>
<html><title>Qmanager Test</title><b>Member Login</b>
<br><form method="POST">Username:
<br><input type="text" name="user" value="">
<br>Password:
<br><input type="text" name="pass" value="">
<br><input type="submit" name="submit" value="Login">
<?php
} else {
//mysql_connect ("localhost", "user", "pass") or die ('My SQL Error: ' . mysql_error());
//mysql_select_db ("database");
$query = "SELECT * FROM users WHERE username = '$username' AND password = '$password'";
$result = mysql_query($query);
if (mysql_num_rows($result) == 1)
{
$row = mysql_fetch_assoc($result);
switch ($row[userlevel])
{
case 1:
header ('Location: ./admin.php');
case 2:
header ('Location: ./manager.php');
case 3:
header ('Location: ./user.php');
}
} else {
echo 'Sorry your username or password are incorrect or not registered with us. Please try again.';
}
mysql_close($server);
}
?>