Re: Can't Read Cookie - URGENT! PLEASE HELP!
| From: | Thomas Deliduka | Date: | Tue, 12 Sep 2000 23:10:57 +0000 |
| Subject: | Re: Can't Read Cookie - URGENT! PLEASE HELP! | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-16460@lists.php.net to get a copy of this message | ||
Try formatting the Date with the specific GMT date string, something like:
$datestring = gmdate("D, d-m-Y
H:i:s",mktime(gmdate(H)+1,gmdate(i),gmdate(s),gmdate(m),gmdate(d),gmdate(Y))
) . " GMT";
Then:
SetCookie("PCDPoll", "1",$datestring, "/",
".pcdiscounters.com");
What I did there is create it for 1 hour. You will have to change it for
however long you would like it.
I found that Netscape will sometimes not expire the cookie or not set it
correctly if the date string isn't exactly like it says it should be.
Reference (read under "expires=DATE"):
http://www.netscape.com/newsref/std/cookie_spec.html
On 9/12/00 6:56 PM this was written:
> On Tue, 12 Sep 2000, Jesse Binam wrote:
>
>> Hello,
>>
>> The script setting the cookie is in a subdirectory. I can read the cookie
>> from the script in the subdirectory but I need to access it from the root
>> directory. I don't get this at all!!! please respond.
>>
>> Here is the code that seems to have the problem
>>
>> script 1:
>>
>> // check if cookie exists
>> if($PCDPoll == "1")
>> // cookie exists
>> $poll_voteValid = 0;
>> else
>> // cookie does not exist yet, set one now
>> setCookie("PCDPoll", "1", time()+604800, "/",
>> ".pcdiscounters.com");
>>
>> script 2:
>>
>> if($PCDPoll == "1")
>> poll_viewResults(1);
>> else
>> poll_generateUI(1,
>> "http://www.pcdiscounters.com/index.htm");
>>
>
> Indeed, something like that was also happening to me. I was trying to set
> a cookie to use the ".blahblah.com" domain parameter, and it worked fine
> on Internet Explorer, but not on Netscape.
>
> I just removed the path and domain parameters and now it works, but it's
> not being restricted to any path or anything like that. It sucks, but oh
> well.
--
Thomas Deliduka
IT Manager
-------------------------
New Eve Media
The Solution To Your Internet Angst
http://www.neweve.com/