Re: Redirection without losing session state

From: Date: Thu, 09 May 2002 02:07:52 +0000
Subject: Re: Redirection without losing session state
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-96738@lists.php.net to get a copy of this message
Vincent Bouret wrote:
I was wondering what command should I use to redirect the user's browser to another page without losing the session state? For example: I have login.php which gather some login informations that are then compared with values inside a mySQL db. If the login and password is ok, I want to start a session and set a variable that tell the user has been authenticated. Then I want to redirect that user to another page without losing the session variables. Why isn't this code working session_start(); echo "ID de session=".session_id()."<br>"; session_register('auth'); $auth = true; echo "Authentifié=".$auth."<br>"; echo "<a href=\"useradd.php\">Go back</a>"; header("Location: http://membres.lycos.fr/someuser/useradd.php"); exit; Thanks
Because you can't add additional headers after output... the error message should have told you that.

« previous php.general (#96738) next »