Count Active visitors





-7
Date Submitted Fri. Mar. 3rd, 2006 8:01 AM
Revision 1 of 1
Syntax Master dannyboy
Tags ASP | COUNTER | VBSCRIPT
Comments 0 comments
The following ASP code will allow you to Count and Display the amount of visitors that are currently on or viewing your website.

You will have to save this ASP code into a file called 'global.asa', which must be uploaded to the root of your webserver.

<SCRIPT LANGUAGE="VBScript" RUNAT="Server">
Sub Application_OnStart
Application("strVisitors") = 0
End Sub

Sub Application_OnEnd
End Sub

Sub Session_OnStart
Application.lock
Application("strVisitors")=Application("strVisitors") + 1
Application.unlock
End Sub

Sub Session_OnEnd
Application.lock
Application("strVisitors")=Application("strVisitors") - 1
Application.unlock
End Sub
</SCRIPT>
 

<%
'Write the amount of active visitors
Response.Write(Application("strVisitors"))
%>
 

Comments

There are currently no comments for this snippet.

Voting