|
-
Feb 26th, 2004, 12:28 PM
#1
Thread Starter
Ex-Super Mod'rater
Cookies and Time Zones [Resolved]
I'm wanting to create a Cookie that only lasts a few hours. I was using this:
PHP Code:
setcookie("CookieName", "Data", time()+60*60*(3+8), "/", ".Domain.com", 0);
The +8 is because my server is based in the PST timezone, however is there a better way so I can create the cookie's time based on the time the browser is using.
Last edited by Electroman; Feb 27th, 2004 at 06:44 AM.
When your thread has been resolved please edit the original post in the thread (  )
and amend "-[RESOLVED]-" to the end of the title and change the icon to  , Thank you.
When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.

-
Feb 26th, 2004, 12:31 PM
#2
Stuck in the 80s
The cookie will last for three hours...regardless of timezone.
-
Feb 26th, 2004, 12:36 PM
#3
Thread Starter
Ex-Super Mod'rater
Before I used the +8 and used:
PHP Code:
setcookie("CookieName", "Data", time()+60*60*3, "/", ".Domain.com", 0);
it was disapearing straight away because the expiry date was past already. on my Machine (running at GMT). Hang on I'll check this again just to make sure.....
When your thread has been resolved please edit the original post in the thread (  )
and amend "-[RESOLVED]-" to the end of the title and change the icon to  , Thank you.
When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.

-
Feb 26th, 2004, 12:40 PM
#4
Stuck in the 80s
Since a cookie is set by the browser on the machine, I'm sure it would automatically set the cookie in the computer's own timezone, unless PHP sends a timestamp for it to expire, rather than number of hours, minutes, etc.
-
Feb 26th, 2004, 12:44 PM
#5
Thread Starter
Ex-Super Mod'rater
Yeah your right, dunno what I must av done wrong before .
When your thread has been resolved please edit the original post in the thread (  )
and amend "-[RESOLVED]-" to the end of the title and change the icon to  , Thank you.
When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.

Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|