RE: [PHP] COOKIE problems

From: Date: Thu, 17 Apr 2003 06:17:14 +0000
Subject: RE: [PHP] COOKIE problems
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-144227@lists.php.net to get a copy of this message
Yes, I am running as CGI. And there WAS an "page can not be displayed" error message in Internet Explorer. I just want to know why this might be happening. Also, the cookies I set are saved in the same directory that session.save_path is set to, so that's why I was assuming it had something to do with that setting. But I may be wrong. I just want to make some type of sense of this and try to fix it somehow. Any ideas, anyone? -----Original Message----- From: Leif K-Brooks [mailto:eurleif@buyer-brokerage.com] Sent: Wednesday, April 16, 2003 9:01 AM To: Navid Y. Cc: php-general@lists.php.net Subject: Re: [PHP] COOKIE problems >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. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.general (#144227) next »