But I don't WANT my cookie to expire!

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
VKX
Forum Commoner
Posts: 41
Joined: Mon Oct 03, 2005 1:43 pm

But I don't WANT my cookie to expire!

Post by VKX »

Is there a way I can make my cookie never expire? If not, what's the maximum duration I can set it for?

Here's my current cookie:

Code: Select all

setcookie("skin", $_POST[SKIN], time()+3600*24*30, "/", ".awesomestart.com");
User avatar
Nathaniel
Forum Contributor
Posts: 396
Joined: Wed Aug 31, 2005 5:58 pm
Location: Arkansas, USA

Post by Nathaniel »

Um. 9999999999999999999999999^99999999999999999 I guess.

It's bad netiquette to have a never-expiring cookie, though. I'd say 6 months would be stretching it, even 3 would be up there unless you had a really good reason to store it that long. And remember that many people routinely delete all of their cookies.
VKX
Forum Commoner
Posts: 41
Joined: Mon Oct 03, 2005 1:43 pm

Post by VKX »

What if I did . . .

Code: Select all

setcookie("skin", $_POST[SKIN], time()+3600*24*30*12, "/", ".awesomestart.com");
That would make it last about a year, right?

I do have a pretty good reason for the cookie . . . http://www.awesomestart.com
User avatar
Nathaniel
Forum Contributor
Posts: 396
Joined: Wed Aug 31, 2005 5:58 pm
Location: Arkansas, USA

Post by Nathaniel »

Ah, that IS a good reason. :)

And yes, that should make it last a year.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

yeah.. it's recommended to only set a cookie for a year ahead at most.
Post Reply