dcsimg

Page Hit Counter System Page 4


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

<SCRIPT LANGUAGE = "VBScript" RUNAT = "SERVER">

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

This article was originally published on Jan 11, 1999
Page 4 of 4

Thanks for your registration, follow us on our social networks to keep up-to-date