cookie

General discussions related to php

Moderators: macek, egami, gesf

Post Reply
User avatar
WiZARD
Moderator
Moderator
Posts: 1256
Joined: Thu Jun 20, 2002 10:14 pm
Location: Ukraine, Crimea, Simferopol
Contact:

Re: cookie

Post by WiZARD » Tue Jul 22, 2003 12:10 am

maby in youre browser cookies is off?

User avatar
WiZARD
Moderator
Moderator
Posts: 1256
Joined: Thu Jun 20, 2002 10:14 pm
Location: Ukraine, Crimea, Simferopol
Contact:

Post by WiZARD » Tue Jul 22, 2003 4:29 am

setcookie ("TestCookie", $value,time()+60*60*24*30); cookie to expire in 30 days. If not set, the cookie will expire at the end of the session (when the browser closes).

User avatar
swirlee
Moderator
Moderator
Posts: 2272
Joined: Sat Jul 05, 2003 1:18 pm
Location: A bunk in the back
Contact:

Post by swirlee » Tue Jul 22, 2003 11:20 am

You can't make a cookie stay alive forever, and for good reason. Just pick a expiration date a long time in the future, and you'll be fine. Think of it this way: Even if you could make the cookie never expire, eventually it would be destroyed or forgotten when the user gets a new computer or reformats their hard drive or suffers a hard OS crash or runs a drive cleaning program.

User avatar
Virtuoso
php-forum Active User
php-forum Active User
Posts: 268
Joined: Mon Jul 21, 2003 7:05 am
Contact:

Post by Virtuoso » Tue Jul 22, 2003 11:29 am

dunno if this is possible, but whenever like the person visits the site, you could unset the cookie and reset it. and you could set the cookie to 1 year, you user is bound to visit your site within 1 year
here is a one year cookie:

Code: Select all

setcookie("cookie",$value, time()+(365*38400));

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests