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.
< SCRIPT LANGUAGE="VBScript" RUNAT="Server" >
Sub Application_OnStart
’ 当服务器开启时,设置用户数为0
Application ("Users") = 0
End Sub
Sub Session_OnStart
Session.Timeout = 20
’ 当开始一个Session时用户数加1
Application.Lock
Application ("Users") = Application("Users") + 1
Application.UnLock
End Sub
Sub Session_OnEnd
’ 当结束一个Session时用户计数器减1
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.