Jump to content


Photo

page redirection problem on new server


  • Please log in to reply
3 replies to this topic

#1 doafee

doafee
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 27 September 2006 - 12:21 AM

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.cittdesig.../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:

<?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); 
} 
?> 



#2 BillyBoB

BillyBoB
  • Members
  • PipPipPip
  • Advanced Member
  • 630 posts

Posted 27 September 2006 - 12:24 AM

actually i have to problem with this site i dont know why it wouldnt work

#3 phporcaffeine

phporcaffeine
  • Members
  • PipPipPip
  • Advanced Member
  • 361 posts
  • LocationOhio, USA

Posted 27 September 2006 - 12:28 AM

using header() & session_start right after one another is very bad mojo.
Thanks,

Ryan Huff
President & Founder, MyCodeTree
support@mycodetree.com | http://mycodetree.com

#4 doafee

doafee
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 27 September 2006 - 04:23 AM

using header() & session_start right after one another is very bad mojo.


Why is it "very bad mojo?"
What are my alternatives?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users