doafee Posted September 27, 2006 Share Posted September 27, 2006 i built a user registration system on an old shared server account a couple months back that work like a peach. i transfered it to another server recently and i am experiencing inconsistent page redirecting. the problem is not consistent and seems to happen more in IE on windows (which doesnt make sense because its PHP). the problem is that: ususally on the first attempt at logging in, the user will be redirected to a blank page (at the same URL as the directed from url) intead of my defined page (the redirect). then, when the user refreshes, it takes him to the correct page (directed to). the blank page has no errors and the url is the same as the "directed from" url (on refresh--it changes to the directed to url). i checked the old server and it is running php4 and the new server is running php5. it seems to me like its a setting issue rather than a coding issue but i dont know--im new at this. if anyone can help, i am deseprate. thanks in advance. Jeremy in action http://www.cittdesign.com/hazmat_boulder/main/login.php user id: 111111111 i also had a blank screen pop up when submitting a new registration form (which happens if you insert a new 9 digit ID so try both) here is the code for the login page: [code]<?php header("Expires: Thu, 17 May 2001 10:17:17 GMT"); header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header ("Cache-Control: no-cache, must-revalidate"); header ("Pragma: no-cache"); session_start(); $title = "Please Login"; // If session has not been set with the session_init initialization file, set the session with the file if (!isset($_SESSION['SESSION'])) { require ("../includes/session_init.php"); } // if the variable $_SESSION['ID_PASS'] has been set, proceed to the registration screen if ($_SESSION['ID_PASS']) { header("Location: registration.php"); exit(); } // Check if any form data has been submitted yet. if (isset($_POST['submit'])) { // Check for an ID equality. if ($_POST['idone'] == $_POST['idtwo']) { // If IDs are equal: // Check if input is less than required digits if (strlen($_POST['idone']) < $id_characters) { $_SESSION['ID_ERROR'] = $less_msg; $_SESSION['ID_PASS'] = FALSE; header("Location: login.php"); exit(); // Check if input is greater than required digits } else if (strlen($_POST['idone']) > $id_characters) { $_SESSION['ID_ERROR'] = $more_msg; $_SESSION['ID_PASS'] = FALSE; header("Location: login.php"); exit(); // Check if input has numeric digits only } else if (!is_numeric($_POST['idone'])) { $_SESSION['ID_ERROR'] = $char_msg; $_SESSION['ID_PASS'] = FALSE; header("Location: login.php"); exit(); } else { $_SESSION['ID_PASS'] = TRUE; $_SESSION['ID'] = $_POST['idone']; header("Location: registration.php"); exit(); } // If IDs are unequal: } else { $_SESSION['ID_ERROR'] = $unequal_msg; $_SESSION['ID_PASS'] = FALSE; header("Location: login.php"); exit(); } // If no form data has been submitted, present screen for the first time } else { include($headerFile); include($loginScreen); include($footerFile); } ?> [/code] Quote Link to comment Share on other sites More sharing options...
BillyBoB Posted September 27, 2006 Share Posted September 27, 2006 actually i have to problem with this site i dont know why it wouldnt work Quote Link to comment Share on other sites More sharing options...
phporcaffeine Posted September 27, 2006 Share Posted September 27, 2006 using header() & session_start right after one another is very bad mojo. Quote Link to comment Share on other sites More sharing options...
doafee Posted September 27, 2006 Author Share Posted September 27, 2006 [quote author=phpORcaffine link=topic=109632.msg442109#msg442109 date=1159316925]using header() & session_start right after one another is very bad mojo.[/quote]Why is it "very bad mojo?"What are my alternatives? 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.