Reply to Re: deleting cookies and local browser time versus server time

Your name:

Reply:


Posted by Good Man on 01/02/08 18:11

lawpoop@gmail.com wrote in news:0ba47cb1-6fbe-44ae-b328-b4415bf387b1
@d21g2000prf.googlegroups.com:

> Hello all -
>
> Is there a way to get the local time from the user's browser? I didn't
> see anything in the $_SERVER array.

Well, considering you're asking the $_SERVER for a local user variable,
it won't be there.

That should also raise a flag for you - since PHP is parsed on the
server, you in fact have no way of determining your user's local time
using PHP.


> For unsetting cookies, the PHP documentation page for cookies
> recommends setting the expiration date to a point in the past.
> However, I'm running into problems with time conflicts. Our server is
> in a different time zone than the browser I'm developing on. I would
> like to go in five-minute increments to test my code after the cookie
> expires, and it took me forever to figure out why my cookies weren't
> expiring in five minutes.

Don't involve the user local time at all. Put the server time in a
variable, and test THAT number in 5 minute increments.


> It's not a big deal because it's only a few hours, so I can set the
> time back several hours when we actually go into production. Of
> course, hard coding any time could fail, is the user is halfway around
> the world. So ideally I could look at the browser's local time, and
> set the cookie back appropriately.

Again, PHP knows nothing about the browser client.

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация