RE: [PHP] Won't save session ids?
| From: | Johnson, Kirk | Date: | Thu, 25 Apr 2002 19:03:02 +0000 |
| Subject: | RE: [PHP] Won't save session ids? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-94628@lists.php.net to get a copy of this message | ||
The coding style needs to match the register_globals setting in php.ini.
register_globals on:
$accountsession = $session;
$accountemail = $email;
session_register("accountsession");
session_register("accountemail");
register_globals off:
Do just like you have it below, except remove the calls to session
_register().
Kirk
> -----Original Message-----
> From: Johan Holst Nielsen [mailto:johan@weknowthewayout.com]
> Sent: Thursday, April 25, 2002 6:14 AM
> To: php-general@lists.php.net
> Subject: [PHP] Won't save session ids?
>
>
> Hi people,
>
> I have a problem with my PHP scripts. I hope someone can help me?
> I run PHP 4.0.6, Redhat 7.1
>
> When i tries to set a session and then redirect to the next page, the
> sessions is empty? Someone know how to solve this problem?
>
> The script looks like this:
>
> session_start();
> session_register("accountsession");
> session_register("accountemail");
> $HTTP_SESSION_VARS["accountsession"] = $session;
> $HTTP_SESSION_VARS["accountemail"] = $email;
> header("Location: ./main.php");
>
> //The session and email variabel is from a output from a
> mysql query!!
> And this works fine!
>
> The mainpage tries to get the sessions.
>
> session_start();
> echo
>
> "Email:".$HTTP_SESSION_VARS["accountemail"]."<br>".$HTTP_SESSI
> ON_VARS["accountsession"];
>
> But i just get a "Email:" without any content?
>
> Please help me? Someone know whats wrong?