> -----Original Message-----
> From: ulf sundin [mailto:[EMAIL PROTECTED]
> Sent: 13 July 2003 23:37
> 
> 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.

Ah, right.  Me, too, actually, which is why I still have the 4.0.6 manual on
my PC!

> 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.

No, I wouldn't expect them to as the manual explicitly says they won't.

>  Use of session_register() seems to be
> required.

Yes. I'd expect that too -- the 4.0.6 manual is again quite clear that you
can only get variables into your session with session_register().

What it's not so clear about is whether

   session_register('foo');
   $HTTP_SESSION_VARS['foo'] = 'bar';

will set the session variable foo to 'bar' under all circumstances -- it
im-plies that it should when register_globals is off, but is very ambiguous
about exactly what  happens when register_globals is on.

Thanks for the heads-up on this topic -- I'm just about to start writing
some code which will make heavy use of sessions, and initially it will have
to work for version 4.0.6 (until my site admin decides to upgrade), so I
guess I've got some heavy testing in prospect on my test server to work out
exactly what all the combinations do -- I need to write stuff that will work
regardless of register_globals, and will continue to work unchanged when the
eventual upgrade to 4.3.x comes along.

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

Reply via email to