-
Hi I am writing a messageboard/forum application and want to include a list of users loged in. What I was wondering was what is the best way to get rid of users that have just gone to another page or disconnected rather than logged out properly.
The users details are stored in an Access Database which contains a field called status (1 for loged in 2 for not).
I guess I could check to see when they last made a request and then have a timeout value of say 20 minutes or so but is there a better way?
Any thoughts appreciated
Alex
-
the only way i would know how to do it is to log the last time a page was requested and ever so often query the db.
there is java commands to do things when a person leaves your page. maybe open up a small web page that tells your cgi that the person is leaving and then closes itself automatically
-
Hi alexmac,
You can use the Session_OnEnd() event in the global.asa file.
-
Thanks for the replys guys! You have given me some things to think about. I think the global.asa idea would work well.
Alex
-
Or whenthe visitor leaves your domain then you would SESSION.ABANDON
DocZaf
{;->
-
I didn't know browsers tell the server it last left that it was going somewhere else??
-
I don't think they do as such
but its something you trap for like :
mouse down event occurs
and if the window.events.srcelement is of type <a> then if the domain is not the same domain as yours then session.abandon
if that makes sense.
DocZaf
{;->
-
Sessions end if the user doesn't request another web page from your server with X minutes of requesting a prior page, with X being either 20 or 30, I can't remember exactly but I'm pretty sure IIS will let you change it anyway ( or turn Sessions off entirely ). They also end with Session.Abandon. You'd use it on a log-out script or before a Response.Redirect to free the chunk of server memory early if you know the user is done or is not coming back.
All a session is is a random-gibberishy Cookie that the server tracks for so long, so it knows whether or not the client has requested earlier pages.
Josh