|
Posted by Mikel Astiz on 09/26/05 13:47
That is exactly what I meant with 'polling', but I would also like to
automatically "timeout" sessions even if no queries are made to the server.
Maybe it would be necessary to add another page to do explicit cleanups?
Mikel
"Erwin Moller"
<since_humans_read_this_I_am_spammed_too_much@spamyourself.com> escribiσ en
el mensaje news:4337b67b$0$11064$e4fe514c@news.xs4all.nl...
> Mikel Astiz wrote:
>
>> 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.
>>
>> Any ideas will be welcome, and please correct me if I said something
>> senseless.
>>
>> Thanks,
>> Mikel
>
> If you are using a database to store your sessions, also store in the same
> row a field named 'lastupdated'.
> Now delete all rows that are not updated for X minutes, where X is
> something
> you think makes sense. (30 minutes eg)
>
> When to run that housekeepingcode?
>
> Why not do it like php does it with file-stored sessions?
> Just run it once every 100 times on avarage.
> (You can use a random number to decide if you need cleaning.)
>
> Just my 2 cents.
>
> Regards,
> Erwin Moller
Navigation:
[Reply to this message]
|