Re: session var being lost between pages
| From: | Chris Lee | Date: | Mon, 01 Oct 2001 14:38:59 +0000 |
| Subject: | Re: session var being lost between pages | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-69456@lists.php.net to get a copy of this message | ||
echo $PHPSESSID on every page, is it the same on every page ?
I usually recommend that you create the register variables too.
else {
$userid = '';
$userpassword = '';
session_register('userid');
session_register('userpassword');
}
if $PHPSESSID is set then session_start() will find it and use it, if your
trying to override HTTP_COOKIE_VARS['PHPSESSID'] with
HTTP_GET_VARS['PHPSESSID'] I would also check if it is not thedefault
allready, change the code to relect that then
if (isset($HTTP_GET_VARS['PHPSESSID']) AND $PHPSESSID !=
$HTTP_GET_VARS['PHPSESSID'])
all small things, nothing big looks wrong. try it and see.
--
Chris Lee
lee@mediawaveonline.com
"Jean-Christian Imbeault" <jean_christian@hotmail.com> wrote in message
news:F111jy3DzB8zICirYfZ0000c3ae@hotmail.com...
> Ok, newbie I am but ... I seem to be losing my session vars when I load up
a
> different php page.
>
> My set-up:
>
> 1- main page starts session and logs user in
>
> if (isset($PHPSESSID))
> session_start($PHPSESSID);
> else
> session_start();
>
> $PHPSESSID = session_id();
> $SID = "PHPSESSID=$PHPSESSID";
>
> if(!isset($userid)) {
> login_form();
> exit;
> }
> else {
> session_register("userid", "userpassword");
> }
>
> Once the user is logged in I have no problem accessin the vars $userid and
> $userpassword.
>
> On the page I even have an <A HREF> link to second php page and the vars
are
> accessible there also.
>
> However this other page has a form. When the user submits the form, a
third
> php page is loaded. On this third page the vars no longer have any values.
>
> Why is this? How can I access the vars from this third page?
>
> Thanks!
>
> Jc
>
>
>
> _________________________________________________________________
> Get your FREE download of MSN Explorer at
> http://explorer.msn.com/intl.asp
>