RE: [PHP] sessions trouble
| From: | Johnson, Kirk | Date: | Tue, 18 Jun 2002 20:12:05 +0000 |
| Subject: | RE: [PHP] sessions trouble | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-102781@lists.php.net to get a copy of this message | ||
Is your version of PHP new enough to support the new $_SESSION[] array? If
it is not, use $HTTP_SESSION_VARS[].
> -----Original Message-----
> From: Leston Drake [mailto:ldrake@lpsoftware.com]
> Sent: Tuesday, June 18, 2002 12:29 PM
> To: Johnson, Kirk
> Cc: php-general@lists.php.net
> Subject: RE: [PHP] sessions trouble
>
>
>
> I have register_globals=Off (which is what I prefer to program for).
> But if I change register_globals to On, and use the
> session_register()
> function, it works.
> With register_globals Off, using $_SESSION doesn't work.
> I thought that $_SESSION would work regardless of whether
> register_globals
> was On or Off.
>
> At 12:19 PM 6/18/2002, you wrote:
> >Check the register_globals setting in php.ini. It looks like
> it is "on" on
> >the problem server. If so, then you have two choices:
> >1. Turn it "off"
> >2. Change your code to this style:
> >
> >session_start();
> >$node = 10.2;
> >session_register('node');
> >echo $node;
> >
> >Kirk
> >
> > > -----Original Message-----
> > > From: Leston Drake [mailto:ldrake@lpsoftware.com]
> > > Sent: Tuesday, June 18, 2002 11:48 AM
> > > To: php-general@lists.php.net
> > > Subject: [PHP] sessions trouble
> > >
> > >
> > > Hello,
> > >
> > > I am unable to retrieve session variables on my local server.
> > > I'm using some code like this to test it (thanks to Ed):
> > > ------------------------------------------------------------------
> > > session_start();
> > > echo ":" . $_SESSION["node"] . "<br>";
> > > $_SESSION["node"] = "10.2";
> > > echo ":" . $_SESSION["node"] . "<br>";
> > > ------------------------------------------------------------------
> > >
> > > Then there is an href link to the same document, to test
> > > whether or not it
> > > can see $_SESSION["node"] the next time.
> > > It can't.
> > > The output for both requests looks like this:
> > > ------------------------------------------------------------------
> > > Warning: Undefined index: node in c:\program files\apache
> > > group\apache\htdocs\test5.php on line 3
> > > :
> > > :10.2
> > >
> > > test
> > > ------------------------------------------------------------------
> > >
> > > On another server
> >(http://www.lpsoftware.com/phptest/test5.php) it works as
> >expected. But I can't figure out why it doesn't work here.
> >I'm running WinME, Apache 1.3.2, Php 4.1.2
> >
> >I have cookies enabled (actually prompted so I can 'see' it)
> for my browser.
> >Is there some setting in php.ini that I need to change?
> >
> >BTW, being a php newbie I really appreciate the helpful
> people on this
> >list! You're a great resource.