Reply to Re: Get cookie expiry time

Your name:

Reply:


Posted by Andy Jeffries on 05/03/06 12:43

On Wed, 03 May 2006 02:32:36 -0700, mymatebob@googlemail.com wrote:
> Sounds a bit overly complicated! But an interesting solution.

Not that complex though, it's only a matter of iterating through $_COOKIE
and resetting each one with a known expiry time (strtotime("+10 minutes
and 20 seconds")). You could do this in a single file and automatically
use it on every page using php_value auto_prepend_file in the Apache
virtualhost.

> It seems strange that there's no method in PHP for obtaining the cookie
> expiry time.

It's not really strange, if you examine the HTTP spec (or watch HTTP
headers using Firefox's Live HTTP Headers) you'll find the browser doesn't
send back the expiry date to the server, only the name and value.
Therefore it's not strange that PHP can't obtain the information, it's
never told (and it can't just remember what it set because it could have
been changed with Javascript or by editing the cookies.txt file).

> Ah well. In the mean time I have stuck with the "storing
> expiry time in another cookie" method. Suppose I could add a Java Script
> function to check the values every second to produce a real time "time
> left until log out" counter.
>
> Many thanks for the response!

You're welcome.

Cheers,


Andy

--
Andy Jeffries MBCS CITP ZCE | gPHPEdit Lead Developer
http://www.gphpedit.org | PHP editor for Gnome 2
http://www.andyjeffries.co.uk | Personal site and photos

[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

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