PDA

View Full Version : help with global.asa



ivan_grozni
04-04-2005, 10:16 AM
hi, I want to use global.asa information to count members online. But...
How to collect information on Sub session_OnStart. I want on:

Sub Session_OnStart
session("IP_number")=Request.ServerVariables("remote_addr")
session("time")=time()
end sub

then want to use this information and put in the table (members table),
and on the end to delete information from table???

HOW, PLEASE HELP ME !!!

Cyberlord
04-07-2005, 10:52 PM
Hi,

this is the code you need to count user online for your webapplication:

add this lines to your global.asa:

Sub Application_OnStart
Application("ActiveUsers") = 0
End Sub


Sub Session_OnStart
Application.Lock
Application("ActiveUsers") = Application("ActiveUsers") + 1
Application.UnLock
End Sub


Sub Session_OnEnd
Application.Lock
Application("ActiveUsers") = Application("ActiveUsers") - 1
Application.UnLock
End Sub

Your code stores only the ip from the client in a session-variable and the beginning of the session.

If you want to see more information who is online, simply store this informations into application-variables.

best wishes