Re: Session variable under PHP 4.0.6

From: Date: Mon, 03 Mar 2003 17:29:13 +0000
Subject: Re: Session variable under PHP 4.0.6
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-137933@lists.php.net to get a copy of this message
Thanks that works in my testing example. But why? The manual says: Caution If you are using $_SESSION (or $HTTP_SESSION_VARS), do not use session_register(), session_is_registered() and session_unregister(). But in index2.php I am using $HTTP_SESSION_VARS and it works?! Need a bit of clarification since my actual app still doesn't work! Henry "Kirk Johnson" <kjohnson@zootweb.com> wrote in message news:B11731D518B5D61183C700A0C98BE0D9FFBEE3@chef... > In the first file, replace this line: > > $HTTP_SESSION_VARS['variable']="the variables value"; > > with these two lines: > > $variable = "the variables value"; > session_register('variable'); > > This is because 'register_globals' is enabled in the php.ini file. > > Kirk > > > -----Original Message----- > > From: Henry Grech-Cini [mailto:henry@teacake.force9.co.uk] > > Sent: Monday, March 03, 2003 9:34 AM > > To: php-general@lists.php.net > > Subject: [PHP] Session variable under PHP 4.0.6 > > > > > > Hi All, > > > > I'm having a problem with session variables under PHP 4.0.6 > > on a secure > > server. I ran phpinfo and have attached the resulting page > > after the main > > body of this message. > > > > My test code looks like this > > > > Filename: index.php > > > > Page Start -------------- > > > > <?php > > session_start(); > > > > $HTTP_SESSION_VARS['variable']="the variables value"; > > > > ?> > > <a href="index2.php">click here</a> to go to the next page > > > > Page End ------ > > > > > > Next file > > Filename: index2.php > > > > Page Start -------------- > > > > <?php > > session_start(); > > > > print_r($HTTP_SESSION_VARS); > > > > echo > > "--&gt;".$HTTP_SESSION_VARS['variable']."&lt;--"; > > ?> > > > > Page End ------ > > > > > > Suffice to say it doesn't work. The first page displays > > > > "click here to go to the next page" > > > > > > as expected. However clicking on the link takes you to > > index2.php and the > > following is displayed: > > > > > > "Array ( ) --><--" > > > > > > Namely that the session variable called "variable" is not set in the > > session. > > > > > > I have run the exact same code on a machine running PHP 4.2.3 > > (non secure > > servers) and it works perfectly! And outputs: > > > > "Array ( [variable] => the variables value ) -->the variables > > value<--"

« previous php.general (#137933) next »