RE: [PHP] Sessions with register_globals = off

From: Date: Fri, 26 Apr 2002 23:02:24 +0000
Subject: RE: [PHP] Sessions with register_globals = off
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-94794@lists.php.net to get a copy of this message
Make sure you are using session_start() on each page and you should be using $_SESSION["var"] = "value";, not $HTTP_SESSION_VARS... ---John Holmes... > -----Original Message----- > From: Padraig Kitterick [mailto:padraigkitterick@oceanfree.net] > Sent: Friday, April 26, 2002 12:16 PM > To: php-general@lists.php.net > Subject: [PHP] Sessions with register_globals = off > > Am in need of help or I will loose my sanity!!! Im runnin Php 4.1.2 with > Apache 1.3.22 on Win32 with register_globals set to off. My script is as > follows: > > <? > > session_start(); > > $myVar = "Something"; > > $HTTP_SESSION_VARS["mySessionVar"] = $myVar; > > ?> > > If I check the cookie, its completely empty. Now if I change this to: > > <? > > session_start(); > > $myVar = "Something"; > > session_register("myVar"); > > ?> > > the cookie now contains: > myVar|s:9:"Something"; > > This is annoying as everyhwhere I read about sessions, Im told that if > register_globals is off, I shouldnt use session_register(), all I need to > do > is: > > $HTTP_SESSION_VARS["myVar"] = $myVar; > > or > > $_SESSION["myVar"] = $myVar; > > but neither work :( > > > > Finally, if I want to change the value of $HTTP_SESSION_VARS["myVar"] and > carry that change over to the next page it doesnt work. For example, i > have > registered the session variable $myVar as above and can read it using > $HTTP_SESSION_VARS["myVar"]. If I do: > > > > $HTTP_SESSION_VARS["myVar"] = "Some other text"; > > > > then $HTTP_SESSION_VARS["myVar"] contains that text, but only for this > page! How do I use sessions then with register_globals = off???!!! > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.general (#94794) next »