Tuesday, December 20, 2011
Do different time zones have any affect on setting a cookie in PHP?
I'm setting up a polling system where users can vote once an hour. I'm using the code setcookie("voted", "1", time()+3600) to set a cookie for one hour. Everything seemed to be fine until I tested the page on an old PC where the time has sped up over time. The PC is at least an hour fast, and the cookie would never set. After searching online, I found some solutions online talking about server time as opposed to browser time. When I changed the clock to the correct time, the cookie sets perfectly. I also tested this out on my Mac with the same results in 3 different browsers. Will this be a problem for users in different time zones? If so, how can I fix this issue? Thanks.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment