Jump to content

Redirection won't work


odetron

Recommended Posts

ok so i ave this code

session_start();


$username = $_POST[‘username’];
$password = md5($_POST[‘password’]);
$logingood = 1;
$query = "SELECT * FROM users WHERE username = '" . $username . "' AND password = '" . $password . "'";

$result = mysql_query($query);
if (mysql_num_rows($result) != 1) {
$error = 'Bad Login';
    include (“login.html”);
} else {
    $_SESSION[‘username’] = '$username';
    $logingood = 2;
}
if ($logingood == 2)
{
echo "Welcome! I will now redirect you to your control Panel!";
if ($username == Odetron)
{
header("location: http://odetron.freehostia.com/Test/comics/comics/admin/");

}
else
{
echo "You are not an admin so get out ";
}
}
?>

I am mainly looking at the section

if ($username == Odetron)
{
header("location: http://odetron.freehostia.com/Test/comics/comics/admin/");

}
else
{
echo "You are not an admin so get out ";
}
}

What its supposed to do is make the user be redirected to the admin cp if there username is odetron, but even thought the username is odetron its saying you are not an admin. what was my error?

Link to comment
https://forums.phpfreaks.com/topic/39102-redirection-wont-work/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.