Statistics how to write the website statistic system with ASP (I.)
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 Visitor IP
Dim m_ip
M_ip=request.servervariables ("Remote_host")
Use the above statement to get the IP of the visitor.
2. Get browser information
Dim O_browser,m_browsertype
Set o_browser=server.createobject ("MSWC. BrowserType ")
M_browsertype=o_browser.browser+o_browser.version
3. Get access Time
Dim M_datetime
M_datetime=year (Date ()) & "/" &right ("0" &month (date ()), 2) & "/" Right ("0" &day (date ()), 2) & "/" &right ("0" &hour (Time ()), 2) & ":" &right ("0" &minute (Time ()), 2) & ":" &right ("0" & Second (Time ()), 2