I'm not the admin on the server, so I'll have to manage with the software provided. And that is php 4.0.6. I've tried a number of ways to store variables in the session file. This works:
session_start(); $foo = 'bar'; session_register('foo'); then after session_write_close(); or end of script: echo $HTTP_SESSION_VARS['foo']; will output 'bar'. just adding variables directly into the HTTP_SESSION_VARS array won't make them stick in the session file. Use of session_register() seems to be required. Ulf "Mike Ford" <[EMAIL PROTECTED]> skrev i meddelandet news:[EMAIL PROTECTED] > > -----Original Message----- > > From: Kevin Stone [mailto:[EMAIL PROTECTED] > > Sent: 09 July 2003 20:30 > > > > ----- Original Message ----- > > From: "ulf sundin" <[EMAIL PROTECTED]> > > To: <[EMAIL PROTECTED]> > > Sent: Wednesday, July 09, 2003 1:00 PM > > Subject: Re: [PHP] session data missing > > > > > > > ok, so now the variable names are registred and stored in > > the file. But > > > without values. > > > check this: > > > > > > --firstpage.php---- > > > session_start() > > > session_register('foo'); > > > $HTTP_SESSION_VARS['foo'] = 'bar'; > > > echo $HTTP_SESSION_VARS['foo']; //outputs bar; > > > > > > transport by a href to: > > > ----secondpage.php---- > > > session_start(); > > > echo $HTTP_SESSION_VARS['foo']; //outputs nothing > > > > > > --- > > > checking the contents of the file called /tmp/sess_{session_id}: > > > !foo| > > (snip) > > > > > > Make a choice here.. > > > > => session_register('foo'); > > => $HTTP_SESSION_VARS['foo'] = 'bar'; > > > > Use either the session_register() function or the session > > global array. Not > > both. > > Not true -- $HTTP_SESSION_VARS is *not* like $_SESSION, and its values are *not* auto-registered. In fact, I still have my copy of the 4.0.6 manual around, and it specifically gives this as an example: > > > Example 1. Registering a variable > > > > <?php > > session_register("count"); > > $HTTP_SESSION_VARS["count"]++; > > ?> > > However, it's a little unclear on whether this should still work regardless of the register_globals setting, as it also gives this as an example: > > > Example 2. Registering a variable with register_globals enabled > > > > <?php > > session_register("count"); > > $count++; > > ?> > > I guess I'd have to go away and try it to be sure of what behaviour occurs for each setting of register_globals -- but there seems little point given that using $_SESSION has been much the best option for several versions now! > > Cheers! > > Mike > > --------------------------------------------------------------------- > Mike Ford, Electronic Information Services Adviser, > Learning Support Services, Learning & Information Services, > JG125, James Graham Building, Leeds Metropolitan University, > Beckett Park, LEEDS, LS6 3QS, United Kingdom > Email: [EMAIL PROTECTED] > Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php