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

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]


УдалСнная Ρ€Π°Π±ΠΎΡ‚Π° для программистов  •  Как Π·Π°Ρ€Π°Π±ΠΎΡ‚Π°Ρ‚ΡŒ Π½Π° 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

Π‘Π°ΠΉΡ‚ ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ Π² Π‘Ρ‚ΡƒΠ΄ΠΈΠΈ Π’Π°Π»Π΅Π½Ρ‚ΠΈΠ½Π° ΠŸΠ΅Ρ‚Ρ€ΡƒΡ‡Π΅ΠΊΠ°
ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ΠΈΠ΅ ΠΈ ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΊΠ° Π²Π΅Π±-сайтов, Ρ€Π°Π·Ρ€Π°Π±ΠΎΡ‚ΠΊΠ° ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΠ½ΠΎΠ³ΠΎ обСспСчСния, поисковая оптимизация