Re: Global Variables

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Dan wrote:
Hi all.

I taught myself PHP before the frenzy over register_globals.
After a reasonable break from the language, I'm back for more.

I'm building a site where I'll be holding a lot of variables in memory for each session. How do I do that? Apparently I can't use session_register() if register_globals is turned off. I've read a little about the consequences of writing bad scripts with register_globals on ... I'm fine with this explanation. I agree that I don't want people injecting variables into my session. What I want is for ME to be able to set variables and remember them throughout the session. How do I do that?


Use the super-global _SESSION array...

session_start();
// -- Some code -- //
$_SESSION['foo'] = 'bar';

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
john@xxxxxxxxxxxx

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux