odetron Posted February 19, 2007 Share Posted February 19, 2007 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? Quote Link to comment Share on other sites More sharing options...
fert Posted February 19, 2007 Share Posted February 19, 2007 if ($username == "Odetron") Quote Link to comment Share on other sites More sharing options...
odetron Posted February 19, 2007 Author Share Posted February 19, 2007 now it says oi can't modify the headers... how do i fix that? Quote Link to comment Share on other sites More sharing options...
fert Posted February 19, 2007 Share Posted February 19, 2007 http://www.phpfreaks.com/forums/index.php/topic,37442.0.html Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.