Re: lack of understanding of sessions

From: Date: Mon, 08 Aug 2005 18:32:22 +0000
Subject: Re: lack of understanding of sessions
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-220242@lists.php.net to get a copy of this message
Hello Sabine, Monday, August 8, 2005, 7:17:51 PM, you wrote: S> When I call the script for the first time the output is: S> if, test: test S> if, sesstest: test S> test: test S> sesstest: test S> if, test2: test2 S> test2: test2 S> on all servers. S> Additionaly I get a warning for the session_register-part on the S> PHP5-server. Thats ok. You shouldn't really be using it even on 4.0.6, best remove it now and the warning will go too. S> PHP4.3.10: S> else, test: S> else, sesstest: S> test: S> sesstest: S> else, test2: S> test2: S> I don't understand, why the variables seem to be empty. Dump out the session contents and see what's in there (if anything): print_r($_SESSION); Equally, dump out the cookie super global to see if the session cookie even got set print_r($_COOKIE); Or use the Web Developer extension for Firefox and "Display cookies" after the first page load - you should see the PHPSESSID cookie in existence. If not, that's the problem. If so, what does it say? S> In the session_is_registered-part, the var seems to be empty, too. Why? Because even 4.0.6 shouldn't be using that function. If you want to check for the existence of a variable, use isset(). Best regards, Richard Davey -- http://www.launchcode.co.uk - PHP Development Services Zend Certified Engineer "I do not fear computers. I fear the lack of them." - Isaac Asimov

« previous php.general (#220242) next »