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? Link to comment https://forums.phpfreaks.com/topic/39102-redirection-wont-work/ Share on other sites More sharing options...
fert Posted February 19, 2007 Share Posted February 19, 2007 if ($username == "Odetron") Link to comment https://forums.phpfreaks.com/topic/39102-redirection-wont-work/#findComment-188298 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? Link to comment https://forums.phpfreaks.com/topic/39102-redirection-wont-work/#findComment-188299 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 Link to comment https://forums.phpfreaks.com/topic/39102-redirection-wont-work/#findComment-188303 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.