Redirection without losing session state
| From: | Vincent Bouret | Date: | Thu, 09 May 2002 00:58:39 +0000 |
| Subject: | Redirection without losing session state | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-96732@lists.php.net to get a copy of this message | ||
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