Forum Moderators: phranque

Message Too Old, No Replies

script to tell viewers how many other visitors are currently online

         

sandor

5:26 am on Jul 4, 2005 (gmt 0)

10+ Year Member



i've seen sites displaying stats such as 'you're X of XX visitors currently online' ... can anyone suggest a place to get a script that can work on a windows server for this .. thanks a lot

Dijkgraaf

1:11 am on Jul 5, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



That depends on where you are holding the count.
You can either do it in the Application Session state (see example below), or if your users have to log in you can track them via entries in a database, and query that.

Examply of Application Session state.

In the global.asa file

Sub Session_OnStart
if not(IsNull(Application("SESSIONCOUNT"))) then
Application("SESSIONCOUNT") = Application("SESSIONCOUNT") + 1
else
Application("SESSIONCOUNT") = 1
end if
End Sub

Sub Session_OnEnd
if not(IsNull(Application("SESSIONCOUNT"))) then Application("SESSIONCOUNT") = Application("SESSIONCOUNT") - 1
End Sub

In the ASP page where you want that count displayed

This is one of <%=Cstr(Application("SESSIONCOUNT"))%> concurrent sessions being served by this site.