Jump to content

Cookie Forever


FrOzeN

Recommended Posts

Set cookie (30 days):
[code=php:0]setcookie("name", "value", time() + 60 * 60 * 24 * 30);[/code]


Remove cookie:
[code=php:0]setcookie("name", "", time() - 3600);[/code]


Is there a better way to make a cookie have a "Remember Forever" option?
Also, is there specific way to remove a cookie?, or do you just set it one hour into the past?
Link to comment
https://forums.phpfreaks.com/topic/23254-cookie-forever/
Share on other sites

[b]Is there a better way to make a cookie have a "Remember Forever" option?[/b]
no. all you can do is keep re-setting it. 

[b]Also, is there specific way to remove a cookie?, or do you just set it one hour into the past?[/b]
that is the specific way to remove a cookie. though i would set it for a day or 2 in the past, not just an hour, due to time zone differences.
Link to comment
https://forums.phpfreaks.com/topic/23254-cookie-forever/#findComment-105416
Share on other sites

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.