Jump to content

Cookies Disabled But PHP Retains Values


Ringer

Recommended Posts

I'm a PHP newbie. Hope this question is not too basic. PHP version is 5.2.1 (Zend Core).

 

I disabled cookies in my browser (IE 6) and am setting a cookie in my PHP script. When I run the PHP script, I can clearly see that the cookie was not saved on my C: drive in the Cookies folder (if I enable cookies, it shows up there).

 

When I reload my script, it still finds the cookie in $_COOKIE. Doesn't PHP do an unset($_COOKIES) after it flushes the HTTP response to the client? I even tried adding random characters to the end of the URL to make sure the browser was not caching the last request (http://www.mySystem.com/testCookie.php?rand=afdsdafsfd). Thanks.

 

$noCookie = false;
if (! isset($_COOKIE['myCookieTest'])) {
     $noCookie = true;
     $expires = time() + 60; 
     $cookieValue = 'My Cookie Value <>& ' . time() ;
     setcookie('myCookieTest',$cookieValue,$expires); 
}

 

Chris

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.