Compiling website traffic statistic system with ASP

Source: Internet
Author: User
Tags servervariables string format

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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.