| 
	
 | 
 Posted by Jimmy on 06/14/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] 
 |