Re: sessions

From: Date: Wed, 18 Apr 2001 11:42:42 +0000
Subject: Re: sessions
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-49182@lists.php.net to get a copy of this message
Rather than bothering with SID whos existance is uncertain, use the variable $PHPSESSID. It's set whenever you use session_start, to my knowledge. The simplest method, and the only one I am aware of, of accessing session variables globally is by explicitly declaring them global in your function. It's also the best way to do it, as it may take extra typing when declaring your function, but it makes it alot more readable and bug-free. -- Plutarck Should be working on something... ...but forgot what it was. ""Ben"" <ben@nyip.net> wrote in message news:9bjn4n$41c$1@toye.p.sourceforge.net... > i'm trying to use sessions with my project, but it seems that registered > variables in a session aren't global by default. > It doesn't even seem like the session is global, because if I reference the > sessionid (which only shows up if cookies are disabled) > by using <?=SID?>, it shows up within a function, if I reference it from > within the function. > > if anyone can help me make my variables (such as $user, and $active) > globally registered with the session, I would be very grateful. > maybe its the cookie not being global, that would explain why the sessionid > shows up only from within a function (but not in the global scope) > > thanks > ben > ben@nyip.net > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.general (#49182) next »