You are here: Re: session ends « PHP Programming Language « IT news, forums, messages
Re: session ends

Posted by Oli Filth on 09/27/05 02:02

Mikel Astiz said the following on 26/09/2005 08:45:
> Hi,
>
> I am looking for a simple way to detect session ends so I can update a
> session table. I am new to PHP and don't understand how such event can be
> handled, since there seems not to be a corresponding overridable function.
> I've found 'register_shutdown_function', but apparently it detects
> connection breaks while the page is being loaded (I'm not sure though).
>
> I supose it will always be possible to control timeouted sessions by
> polling, but I wouldn't like to do so. Of course, client side scripts are
> not enough. I want to handle broken connections and prevent from evil users
> too.
>

You can't handle session timeouts directly, and even if you could, it
would be unreliable/inconsistent as the timeouts are govenered by a
garbage collector.

Why don't you do the cleanup each time the script is run? i.e. assuming
you are keeping track of sessions in a table (with an associated
timestamp), then every time the script is run, look for entries with a
timestamp set too far in the past, and do the relevant cleanup.
(basically what Erwin said in his first reply)


--
Oli

 

Navigation:

[Reply to this 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

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