And I learn to do the strongest function of the site statistics, an ASP production examples of statistics

Source: Internet
Author: User
A statistical example of how visitors can number, record access times, IP, and time.
I made a website, www.zydn.net of course, like everyone else, also put a counter in the top, every day to see the counter are constantly turned, the heart is very happy, but then I think, in the end who saw my website ah? A new friend or an old friend? I don't know how many times they've been here, I also want to give them a number, so I applied for free statistics, but for a change of N are not satisfied, alas, it seems, only their hands to have enough to do, said dry, level smelly, but also hope that the master jokes, not visit the advice.
I use the Access library as an example, in fact, with the SQL Server library, just change the statement of the link library,
The library structure is as follows
Library filename: CONT. ASP was originally Cont.mdb but after construction, the extension was changed to ASP, in case the library was downloaded.
Table Name: Tab
Field Name Data type description
ID AutoNumber number of Visitors
IP text is used to record the IP of a visitor
DAT1 date time to record the last visit of the visitor
DAT date time is used to record the time of the first visit of a visitor
CS number, Integer used to record the number of visitors visited
The program is simple, only two files, dispcont.asp to display statistical results, contpage.asp for statistical information,
First look at the contpage.asp is the first statistics, the code is as follows:
<%
Set conn=server.createobject ("ADODB. Connection ")
Connstr= "dbq=" +server.mappath ("cont.asp") + ";D efaultdir=;D river={microsoft Access DRIVER (*.mdb)};"
Conn.Open CONNSTR ' * * * The above statement is used to connect the library, cont.asp is the library file name.
Keren=request.cookies ("Keren") ' reads Cookies,cookies's name: "Keren", haha. Ah Yu's e-literature stinks, only know how to use pinyin.
If keren= "" Then ' Judge Cookees is not empty, if it is empty, then must be new friends, otherwise it is an old friend.
Sql= "SELECT * from tab where Id=-1"
Set Rs=server.createobject ("ADODB. Recordset ")
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.