Implementation of ASP record clicks

Source: Internet
Author: User
Tags readline
How to use the number of clicks in HTML

<a href=counter.asp?save=123&url=http://127.0.0.1/>http://127.0.0.1 </a>
Total Hits: <script src=view.asp?save=123> </script>


Counter.asp
*************************
<%
Path= "D:data"
File=request ("Save")

Url=request ("url")
Set fs = CreateObject ("Scripting.FileSystemObject")
If Fs. FileExists (Path & File & ". txt") Then
Set thisfile = fs. OpenTextFile (Path & File & ". txt", 1, False)
Number=thisfile.readline + 1
Thisfile. Close
Set Outfile=fs. CreateTextFile (Path & File & ". txt")
OutFile. WriteLine number
Outfile.close
Set fs=nothing
Else
Number=1
Set Outfile=fs. CreateTextFile (Path & File & ". txt")
OutFile. WriteLine number
Outfile.close
Set fs=nothing
End If

Response.Redirect URL

%>



View.asp
***************************
<%
Path= "D:data"
File=request ("Save")
Set fs = CreateObject ("Scripting.FileSystemObject")
If Fs. FileExists (Path & File & ". txt") Then
Set thisfile = fs. OpenTextFile (Path & File & ". txt", 1, False)
Number=thisfile.readline
Thisfile. Close
Set fs=nothing
Else
Number=0

End If
Response.ContentType = "Application/x-javascript"
Response.Write "document.write (" "" & Number & ""); "

%>

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.