I found a little snippet for Global.asa code that is supposed to count concurrent users and it seems to work except the count is not accurate: if I'm the only one using the site (on my local system), the count is "1" as it should be, but if I open a second browser, the count is "3" which seems to grow as I open more browsers until suddenly it seems to match what's open. I do not quite follow how this code works but maybe someone can help shed some light on it for me. Actually I don't need the "visits" part but removing it seems to crash the whole thing.
[tt]Sub Application_OnStart
Application("visits"
= 0
Application("Active"
= 0
End Sub
Sub Session_OnStart
Session.Timeout = 1
Session("Start"
=Now
Application.lock
Application("visits"
= Application("visits"
+ 1
intTotal_visitors = Application("visits"
Application.unlock
Session("VisitorID"
= intTotal_visitors
Application.lock
Application("Active"
= Application("Active"
+ 1
Application.unlock
End Sub
Sub Session_OnEnd
Application.lock
Application("Active"
= Application("Active"
- 1
Application.unlock
End Sub[/tt] Don
don@pc-homepage.com
Experienced in HTML, Perl, VBScript, PWS, IIS and Apache. Run OS/2 Warp 4, BeOS v5 and Windows NT/2000 (only when I have to!)
[tt]Sub Application_OnStart
Application("visits"
Application("Active"
End Sub
Sub Session_OnStart
Session.Timeout = 1
Session("Start"
Application.lock
Application("visits"
intTotal_visitors = Application("visits"
Application.unlock
Session("VisitorID"
Application.lock
Application("Active"
Application.unlock
End Sub
Sub Session_OnEnd
Application.lock
Application("Active"
Application.unlock
End Sub[/tt] Don
don@pc-homepage.com
Experienced in HTML, Perl, VBScript, PWS, IIS and Apache. Run OS/2 Warp 4, BeOS v5 and Windows NT/2000 (only when I have to!)