countdrac Posted November 25, 2007 Share Posted November 25, 2007 for some reason this page does not redirect as it should... very strange... i have no idea why?! <?php session_start(); if (isset($_GET['redir'])) { $redir = "?redir=".$_GET['redir']; $redirIn = $_GET['redir']; } else { $redirIn="admin.php"; $redir="?redir=admin.php"; } if (isset($_SESSION['logged_in'])) { if ($_SESSION['logged_in'] == 1) { header("Location: admin.php"); } } else if (isset($_POST['password'])) { if ($_POST['password'] == "password") { $_SESSION['logged_in'] = 1; header("Location: admin.php"); } } ?> these headers are never executed? thanks Quote Link to comment https://forums.phpfreaks.com/topic/78797-help-with-session-and-headers/ Share on other sites More sharing options...
jscix Posted November 25, 2007 Share Posted November 25, 2007 Well, What happens.. do you get a white screen? an error? Anything? Quote Link to comment https://forums.phpfreaks.com/topic/78797-help-with-session-and-headers/#findComment-398760 Share on other sites More sharing options...
countdrac Posted November 25, 2007 Author Share Posted November 25, 2007 so what happens is that it just continues to reload the page and doesnt redirect as it should when the correct password is entered Quote Link to comment https://forums.phpfreaks.com/topic/78797-help-with-session-and-headers/#findComment-398762 Share on other sites More sharing options...
jscix Posted November 25, 2007 Share Posted November 25, 2007 Well, if thats happening then the redirect code is never being executed so, check to see if your form fields have the correct names associated with your php post variables, Quote Link to comment https://forums.phpfreaks.com/topic/78797-help-with-session-and-headers/#findComment-398770 Share on other sites More sharing options...
countdrac Posted November 25, 2007 Author Share Posted November 25, 2007 so while trying to debug i did this... <?php session_start(); if (isset($_GET['redir'])) { $redir = "?redir=".$_GET['redir']; $redirIn = $_GET['redir']; } else { $redirIn="admin.php"; $redir="?redir=admin.php"; } if (isset($_SESSION['logged_in'])) { if ($_SESSION['logged_in'] == 1) { echo "logged in... redir "; } } else if (isset($_POST['password'])) { if ($_POST['password'] == "OApass") { $_SESSION['logged_in'] = 1; echo "passwrd logged in... "; } } ?> and the echos are executed exactly where they should be! Quote Link to comment https://forums.phpfreaks.com/topic/78797-help-with-session-and-headers/#findComment-398777 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.