GuidesPage Hit Counter System Page 4

Page Hit Counter System Page 4




The following code will need to added to your global.asa
file:

Sub application_OnStart
  Application(“a_online_user”) =
0    ‘init our 2
variables

  Application(“a_max_connect”) = 0
End
Sub

Sub Session_OnStart
  Application.Lock   ‘Lock the application
  online =
CInt(Application(“a_online_user”)
  online = online +
1
   Application(“a_online_user”) = online  
‘increment current online
users

   max_online =
CInt(Application(“a_max_connect”)
   if online >
max_online then   ‘see if the # of
users online is at the highest
point

      
Application(“a_max_connect”) = online   ‘update highest number
   end
if
   Application.Unlock
End Sub

Sub
Session_OnEnd
   Application.Lock   
‘ User left, subtract 1 from online
users

   online =
CInt(“Application(“a_online_user”)
   online = online –
1
   Application(“a_online_user”) =
online
   Application.UnLock
End Sub

THE
WORKING EXAMPLE

Latest Posts

Related Stories