Re: Session Vars
| From: | CPT John W. Holmes | Date: | Thu, 19 Jun 2003 13:20:33 +0000 |
| Subject: | Re: Session Vars | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-152155@lists.php.net to get a copy of this message | ||
> setting up some pages to allow users to log in, and store their userID in
a
> session var.
> for development purposes, i've installed AMP on my windows box.
>
> -everything parses fine
> -register globals is on.
>
> problem: session vars do not seem to be carrying over pages, even when i
set
> the session_id to initial value.
>
> i start the session and save the variable:
>
> session_start();
>
> $PHPSESSID=session_id();
>
> $_SESSION['userID'] = $userID; //i've checked and $userID DOES contain a
> value: 1
> //If i echo $_SESSION['userID']; then it prints 1.
>
>
> header("Location: nextpage.php?PHPSESSID=$PHPSESSID");
>
> exit;
>
>
> on nextpage.php:
>
> session_start();
>
> session_id($PHPSESSID);
Please note the second sentence in this direct quote from the manual:
If id is specified, it will replace the current session id. session_id()
needs to be called before session_start() for that purpose. Depending on the
session handler, not all characters are allowed within the session id. For
example, the file session handler only allows characters in the range a-z,
A-Z and 0-9!
Thank you.
---John Holmes...