![]() |
|
#1
|
|||
|
|||
Tracking logged in usersI have a table that keeps track of any people that are currently logged in to the system. When they manually log out it removes them from the "logged in" table in my database. I also wrote a timeout script. Everytime a new page loads it first checks to see if the current time is past the time that he scheduled to time out at (e.g. 20 minutes). If the current time is past the scheduled time out time, then it logs them out and deletes them from the table. If the user still has time remaining in his session, then it sets a new timeout time to 20 minutes from the current time.
This systems works but has one flaw, if the user closest out his browser hence not logging out first nor refreshing the page (to run the timeout script again), the user never gets deleted from the database. Is there a way I can get around this, like to see if his browser browser was closed? Edit: sorry, I just realized I posted in wrong forum! |
|
#2
|
|||
|
|||
|
One of these three :
1. Use the Javascript event onload function in body to call the logout script. JS may not work all time if JS is disabled or popup-blockers disable unload event. 2. Next time the user logs in check if hes still having a prev session data in the db - if so remove it - atleast this will remove redundant entries from sessions table. 3. Cron Job - Write a script to check the last time timeout script was run by the user. Have this Cron Job set every 20-25 mins ? |
Recent GIDBlog
NARMY by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Google Adsense introduces tracking by URL | Div | Advertising & Affiliates Forum | 1 | 14-Dec-2004 07:14 |
| tracking city and country from IP address | s786787 | Web Design Forum | 5 | 06-Nov-2003 23:23 |
| Mvtracker.com - usefull tracking | mvtracker | Advertising & Affiliates Forum | 1 | 31-Aug-2003 06:18 |
| Script needed for letting user input a few days of data for tracking and analysis. | tradertt | MySQL / PHP Forum | 3 | 06-Mar-2003 02:54 |
| Slight increase in Netscape users? | JdS | Web Design Forum | 10 | 01-Sep-2002 11:59 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The