ASP to make multi-user version counter

Source: Internet
Author: User
Tags microsoft frontpage
ASP to make multi-user version counter
2000-06-30 · Guo Wu · Cpcw
Use ASP to make the website counter, generally adopt ASP's built-in object application, use a text file to save the value, here I will introduce another method, use the database to make, and is multi-user version, so, not only can own use, and can serve for other website. The following are the specific practices:
Pre-production preparation
Because you want to use a database to store values and user information, you must first create a database (which we use in Access format) and use Microsoft Access to create the following database:
The database name is: Count.mdb
Table Name: counttable
There are the following fields:
user:[data type: text, field size: 255] Save user name
pageurl:[data type: text, field size: 255] Save user Home Address
curvalue:[data type: number, field Size: Long integer Save counter value
At the same time need to prepare 10 pictures: 0-9, placed in the directory "1", the file name is 0.gif,1.gif ... (The count value used for graphical display)
User Application Form Making
You can use Microsoft FrontPage to make the following counter requisition form with the file name saved as: get.htm
<form method= "POST" action= "getcl.asp" >
<p> username <input type= "text" name= "user" size= "></p>"
<p> counter value <input type= "text" name= "Curvalue" size= "></p>"
<p> Home Address <input type= "text" name= "Pageurl" size= "></p>"
<p><input type= "Submit" value= "submitted" name= "B1" ><input type= "reset" value= "all Rewrite" name= "B2" ></p>
</form>
The action= "getcl.asp" in the form represents the use of getcl.asp files to handle user input, so how do getcl.asp files handle user input and add user input to the database? The following methods are:
<% ' Establish a connection with the database
Set conn = Server.CreateObject ("ADODB. Connection ")
Dbpath=server. MapPath ("Count.mdb") ' Gets the actual path of the database
Conn.Open "Driver={microsoft Access driver (*.mdb)};d bq=" &dbpath
Set Rs=server. CreateObject ("Adodb.recordset")
' Get user information
User=request.form ("User")
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.