Jump to content

cookie bug when using a subdomain


aooga

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

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.