Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asptoday_discuss thread: Tracking Who's Online


Message #1 by "Jeremy Palmer" <medicalendar@h...> on Thu, 11 Jul 2002 17:29:34
I would like to display whether or not a member is currently online when 
they have logged into my site, so that other members can see their status.

How would I go about doing this.  I suspect, it would involve session 
variables at some level?

Any code samples would be helpful.

My platform is ASP 3.0 and SQL 2K

Thanks,

Jeremy
Message #2 by "Mark Phillips" <webmaster@d...> on Thu, 11 Jul 2002 17:34:08 -0500
The most logical way would be to have some means of looping through the current sessions. However
there's no way to do this with ASP/VBScript.

Since all the site members on my site are in a database, I added a column to indicate the time of their last activity and a column
to indicate if they are online. 

When they log on, Last Activity is updated to the current date time, and OnlineNow is set to 1. 

When they load a page an include file looks to see if the session has a MemberID in it and if it does, again it updates the Last
Activity time in the database for the member.

I also have a scheduled stored procedure that runs every 5 minutes and sets OnlineNow = 0 if the time of their last activity was
more than 20 minutes ago.

Thus to display a list of the people online, just query the members table and return records WHERE OnlineNow = 1

You could also use an application level array instead of a database table.

Hope this helps,
Mark

---------- Original Message ----------------------------------
From: "Jeremy Palmer" <medicalendar@h...>
Reply-To: "ASPToday Discuss" <asptoday_discuss@p...>
Date:  Thu, 11 Jul 2002 17:29:34

>I would like to display whether or not a member is currently online when 
>they have logged into my site, so that other members can see their status.
>
>How would I go about doing this.  I suspect, it would involve session 
>variables at some level?
>
>Any code samples would be helpful.
>
>My platform is ASP 3.0 and SQL 2K
>
>Thanks,
>
>Jeremy
>

--
Mark

Domain Name Registration, Hosting and Design Services
http://www.demontools.net

--

  Return to Index