Re: COOKIE problems

From: Date: Wed, 16 Apr 2003 16:01:24 +0000
Subject: Re: COOKIE problems
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-144139@lists.php.net to get a copy of this message
I have set my session.save_path to C:/PHP/tmp_sessions, from the default. Does this change also affect the way I use cookies? No, session.save_path only affects sessions.
The problem I'm having with cookies is that I set a cookie and I confirm to see if it exists by running a print_r($_COOKIE). Ok, so the cookie I set exists. Now I test it in an if() statement like so: index.php ------------------------------ if (isset($_COOKIE['var'])) { [Do This] } else { [Do That] } When I do this it shows that the index.php page doesn't even exist. But when I say: index.php ------------------------------ if (!isset($_COOKIE['var'])) { [Do This] } else { [Do That] } The index.php page loads just fine. So how can it not exist in an if() statement after I've already tested its existance and confirmed that it does, in fact, exist? Actually, what confuses me is why the index.php page doesn't even load at all while checking the cookie's existance in the if() statement. This is all really frustrating to me. I would really appreciate your help, guys. Note: The cookie I set doesn't expire for a long while. I set the cookie on a separate page than the index.php page, then used the header()'s redirect function to redirect to the index.php page. Also sessions work fine using the current session.save_path setting. The cookies get set and are saved in that directory that I asked it to save it to. My guess is that there was a parse error in the first example which you didn't put into the email. This would bring up the "page can not be displayed" error message in Internet Exploiter if PHP is running as CGI.
-- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.

« previous php.general (#144139) next »