Jump to content

Recommended Posts

I've been using cookies on my server for awhile, then I was upgrading and dumped my previous version into a folder 0.1 so now I access it at localhost/0.1/ and suddenly my logout script doesn't work anymore

function logout(){

$past = time() - 100;

setcookie('ID', gone, $past);

setcookie('Key', gone, $past);

}

Now everytime I log out a new ID cookie is created. It seems setcookie can create cookies in path 0.1 but doesn't find them to edit them?

Link to comment
https://forums.phpfreaks.com/topic/140639-cookie-bug-when-using-a-subdomain/
Share on other sites

It is suggested to do more than 100 for expire time due to timezone issues, I would set the $past to time()-3600*48;  (2 days ago).

 

Working with cookies on localhost can also be tricky, checkout this article:

 

http://www.aeonity.com/frost/php-setcookie-localhost-apache

 

 

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.