|
|
|
Count Active visitors
-7
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.
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"))
%>




There are currently no comments for this snippet.