Re: Re: Redirection Question (I spoke to soon)

From: Date: Wed, 23 Jul 2003 01:46:37 +0000
Subject: Re: Re: Redirection Question (I spoke to soon)
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-156367@lists.php.net to get a copy of this message
Beauford.2005 wrote:
Sorry all, apparently this doesn't work on either Windows or Linux. Again, I thought it was working and once I got farther along I see that it really wasn't. Basically what I get after I login is an empty screen. Here is what I have : This is the script that runs to see if the user is logged in. session_start(); if(!$_SESSION['logged']) { session_register('goto');
    	$_SESSION['goto'] = "http://" . $_SERVER['SERVER_NAME'] .
$_SERVER['REQUEST_URI']; $url = "http://www.mysite.org/login/login.php"; header("Location: $url"); } The above works and redirects me to the login page and has the right referring page as shown below. goto|s:59:"http://www.mysite.org/setup/inputs.php"; This is in my login.php script. After I verify the user login is correct, this piece of code is executed. session_start();
            session_register('logged');
            session_register('user');                                      $_SESSION['logged'] = "True";
            $_SESSION['user'] = $row['user'];
                                    $target = "Location: " . $_SESSION['goto'];
            session_unregister('goto');
                                    header($target);
What I get after this is a blank page. The user has been logged in and shows in the session file, but it just isn't redirecting.
1. DON'T mix session_register() and $_SESSION. 2. Add an exit(); after you redirect with header(). -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ PHP|Architect: A magazine for PHP Professionals – www.phparch.com

« previous php.general (#156367) next »