The amount of traffic on the web is a matter of great concern to every netizen who makes a website. How do you know how many people are visiting your website? How do I record the amount of visits I make every day? Here is a solution.
When a user starts to visit the site, the server-side global.asa will be accessed. A session will be opened for the user. You can set up your own personal user information for each user. There's not much to explain here. There is a message response function in Global.asa when the application starts and session starts. You can typing the following code.
Copy Code code as follows:
< SCRIPT language= "VBScript" runat= "Server" >
Sub Application_OnStart
' Set the number of users to 0 when the server is turned on
Application ("Users") = 0
End Sub
Sub Session_OnStart
Session.Timeout = 20
' When starting a session, the number of users plus 1
Application.Lock
Application ("users") = Application ("users") + 1
Application.UnLock
End Sub
Sub Session_OnEnd
' User counter minus 1 when ending a session
Application.Lock
Application ("users") = Application ("Users")-1
Application.UnLock
End Sub
</script >
When the site is run, the application variable application ("Users") will keep track of the number of online sites. You can use the number of online users to write on any Web page. As for records, you can use a number of methods. If you are logging into a file, you can use the Scripting.FileSystemObject object for processing. If you log in to the database, you can use ADO and so on. Here is not a description.