Click to See Complete Forum and Search --> : User presence monitoring
Ipsens
August 28th, 2006, 07:32 PM
Hello
I'm using PHP&MySQL
So when user login, time is recorded in DB.
When he push log out button, time is recorded in DB.
When he turns off his computer, or close browser, logout field holds NULL value (Log out NOT pushed).
How to fight that issue?
PeeJavery told me that it can be solved through Ajax only.
Ipsens
September 7th, 2006, 05:51 PM
What?
No reply?
AJAX seems to be quite unpopular... LOL!
Ipsens
dmeikle
September 11th, 2006, 02:15 PM
I'm not sure if you can do this with PHP, but here's what you 'could' do if it were java - perhaps PHP has something similar to this:
when a user logs in, add their information to a list stored globally (in java this could be in a singleton. with .net you can simply store this in the Server object). every time someone hits the server with a link or button click, it resets a time stamp. run a thread that checks for 'dead users' every couple of minute - if the time stamp is stale (has exceeded the max time allotted for a live session -eg: past 20 minutes) stamp them as 'logged out' in the database. if they were logged in and created a session, that session would have expired at 20 minutes (default setting) anyways and they'd have had to relogin.
gitter1226
September 23rd, 2006, 11:55 AM
My product, also written in php is similar. What you need to do is, rather than just stamp a time for login/logout, is create a session object on server side. I have a simple process, written in c, that monitors those sessions and does numerous things. One of its functions is to end the session when the timeout value has been reached.
Good luck!
codeguru.com
Copyright WebMediaBrands Inc., All Rights Reserved.