Page 1 of 1

Number of Online User Problem

Posted: Tue Jan 11, 2005 4:10 am
by fadi
Hi Folks,
i've recently made a script which tells the exact number of online users on my website. Method i am using is following
1. i ask username and password
2. if matches in database than insert in another table
3. On Sign Out i delete that user.
it works fine as far as it is concerned with sign out.

but i dont have any solution if user clicks the Cross button of browser and session is lost .But infact i cant delete that user from table. Is there any way to sort out this problem , plz help 8O

Posted: Tue Jan 11, 2005 7:11 am
by hawleyjr
The best way to do this (and there are a ton of post on this site about this) is to put an insert/update query in every page. After x amount of time (5 - 10 minutes) Assume the user is no longer there and do not display them as being there. There are a couple ways to do this. one way is to run a cron job that removes all entries older then x minutes. another is to just write your quiery to only count those that are <= x minutes old.

Posted: Tue Jan 11, 2005 8:59 am
by feyd
search for "who online"