This is a neat little script that will tell you how many active users you have on your site. It can be somewhat disheartening if you don't get any though!
What is required is somewhere to store the number of people which will be a variable i.e. amount of people on your site will vary. You will need to create a separate file in which to store this variable. For this purpose we use the global.asa. I am not going to go into too much detail about this file other than to tell you to cut and paste the code below into the file called global.asa
<script language="vbscript" runat="server">
Sub Application_OnStart
Application("Active")=0
End Sub
Sub Application_OnEnd
'no code is needed here
End Sub
Sub Session_OnStart
Session.Timeout=20
Session("Start")=Now
Application.Lock
Application("Active")=Application("Active")+1
'this adds 1 to the number of active users
when a new user hits
Application.unlock
End Sub
Sub Session_OnEnd
Application.Lock
Application("Active")=Application("Active")-1
'this subtracts 1 from the number of active
users when a new user leaves
Application.unlock
End Sub
</script>
The above is your global.asa file, below the code that you should cut and paste into another file. You can call the file whatever you like, though I'll call it 'active_users.asp'
<html>
<head>
<title>active users</title>
</head>
<body>
You are one of <%= Application("Active")%> current
users.
</body>
</html>
Upload both files on to the net making sure that the 'global.asa' is in the root directory. Run the file 'active_users.asp' and you'll discover how many active users you have.
Get the best asp web hosting provider now and save 30%
Plug and play ASP membership script that integrates with PayPal to let you charge recurring membership fees.