In the current Web site statistics System is most of the CGI, but the writing is particularly complex, and the ASP to learn simple, more and the advantages of combining the database, so the combination of their own has done the site statistics system, and we discuss the ASP to write a Web site statistics system.
We have seen NetEase's website statistics system, it can statistics total traffic, the average daily traffic, the day visits, the highest traffic, the highest access date, daily traffic analysis, monthly traffic analysis, weekly flow analysis, browser analysis, and so on.
In fact, to do an ASP access statistics system is the key to the system table structure design. And how to capture the user's CGI variables, and how to display the user's information. In other words, the key of the system is two ASP programs, statistical programs and display programs.
First we look at how to capture the user's access information.
We write access statistics need to know the users of the following information, the visitor's IP (according to the Access IP can form a visitor IP list), the visitor's browser and operating system (statistics visitor's browser and operating system and all visitors browser and operating system scale map), visitor's visit time (Carry on daily traffic analysis, Monthly traffic analysis, weekly traffic analysis), below we look at the use of ASP to obtain the above information statements:
1, get the visitor IP
Dim m_ip
M_ip=request.servervariables ("Remote_host")
Use the above statement to get the IP of the visitor.
2, access to browser information
Dim O_browser,m_browsertype
Set o_browser=server.createobject ("MSWC. BrowserType ")
M_browsertype=o_browser.browser+o_browser.version
3. Access time
Dim M_datetime
M_datetime=year (Date ()) & " /"&right (" 0 "&month (date ()), 2) &" Right "(" 0 "&day (date ()), 2) &"/"&right (" 0 "&hour ( ) (2) & ":" &right ("0" &minute (Time ()), 2) & ":" &right ("0" &second (Time ()), 2)
4, access to the user's operating system.
Use the following statement in the ASP to get the Http_user_agent string for the visitor.
Dim struseragent
Struseragent=request.servervariables ("Http_user_agent")
This string is typically in the following format:
mozilla/4.0 (compatible; MSIE 4.01; Windows 98)
The string above can indicate that the visitor is using an operating system that is Windows98 and the browser is MSIE 4.01, but the string format is not fixed and can be changed on its own.