Re: session data missing

From: Date: Wed, 09 Jul 2003 19:00:38 +0000
Subject: Re: session data missing
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-154615@lists.php.net to get a copy of this message
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| I guess it should be something like !foo=bar| but, as I said, the values doesnt seem to stick in the file, just the names of the variables. I must be doing something wrong. Regards Ulf "Mike Ford" <M.Ford@lmu.ac.uk> skrev i meddelandet news:841D90E489448A4F804E1D1B95768BF7D4613B@lis-exchange3.lmu.ac.uk... > > -----Original Message----- > > From: ulf sundin [mailto:majikthse@spray.se] > > Sent: 09 July 2003 01:01 > > > > After creating a new session with session_start() and > > inserting a few values > > e.g $HTTP_SESSION_VARS['foo'] = 'bar'; a file > > /tmp/sess_{session_id} is > > created. > > The problem is that this file is empty! 0 bytes. no data is stored. > > I'm using php 4.0.6 on linux with apache 1.3 something. > > Just doing session_start() will create the file. Are you also > session_register()-ing your session vars? The $HTTP_SESSION_VARS array > isn't like the $_SESSION array introduced in PHP 4.1 -- it's values are not > automatically registered. You still have to use session_register(), thus: > > session_start(); > session_register('foo'); > $HTTP_SESSION_VARS['foo'] = 'bar'; > > HTH > > 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: m.ford@lmu.ac.uk > Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211

« previous php.general (#154615) next »