You are here: Re: Sessions/Online Users « All PHP « IT news, forums, messages
Re: Sessions/Online Users

Posted by Jimmy on 09/28/24 11:40

Rich wrote:
> Hi there,
>
> Apologies if this has already been asked before, but..
>
> I'm relatively new to PHP, I can do the basic stuff with sessions, cookies
> and MySQL. What i'm looking to do is, something like this:
>
> A user is provided a unique code to access my site, randomly generated.
> A user logs in to my site with the specific code.
> They are registered as 'online'.
> If somebody has inadvertantly acquired this unique code and attempts to
> login with the same code, and the existing user is already using it - deny
> entry.
> If the original users PC crashes, or another problem causes them to
> disconnect from the site - detect this and allow them entry next time.
>
> Now, my issue is this. I can set a session/cookie when the user logs in, no
> problem at all. But how can I detect whether or not their session has died,
> and not expired?
>
> I guess I can use MySQL to update a field if they are online, but I couldn't
> think of anything at all server-side to detect if their session has died,
> and to flush that field?
>
> Any helpful advice and pointers are welcome.
>
> Thanks in advance,
> Rich
>
>

If your server supports cron jobs, you could set that to run every 10/20
minutes.

Are you storing the time in the DB too??

 

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

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