Display the Number of Users Online   
 

The codes contain two parts. The first part is part of the "global.asa" file which is to be placed directly under your root directory. The second part is the code to display the actual number of people online. You can also easily use the Client's Info code to find out your visitor's IP address and the time they visited your site.

The Code:

'--- codes to be placed in global.asa
<script language=VBScript runat=Server>
Sub Application_OnStart
    Application("WhoOn") = 0
End Sub

Sub Application_OnEnd
    '---nothing here
End Sub

Sub Session_OnStart
    Session.Timeout = 20
    '---lock Application variable before updating
    Application.Lock
        Application("WhoOn") = Application("WhoOn") + 1
    Application.Unlock
End Sub

Sub Session_OnEnd
    Application.Lock
    Application("WhoOn") = Application("WhoOn") - 1
    Application.Unlock
End Sub

</script>


code to display the actual number online
<%=Application("WhoOn")%> online now

The Result:

Number of Users on psacake.com now: 34

My3C's
perrychicker
It's easy... it's a PSACAKE!
Back | Tell A Friend | Search this Site
1998 - 2014 psacake.com
Version 3.23

Send me One Million FREE Guaranteed Visitors