如何实现点击数的计算?_编程10000问

counter.htm<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />


<a href=counter.asp?save=123&url=http://127.0.0.1/>http://127.0.0.1</a>
共点击次数:<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 & """);"
%>

[1]

时间: 2024-10-18 07:26:50

如何实现点击数的计算?_编程10000问的相关文章

ASP问答集_编程10000问

问:为什么我的记录集的RecordCount值总是返回-1? 答:你应当使用这种模式来打开存取数据库的记录集:   rec.open strSQL,conn,1,1   其中的strSQL是操作数据库的SQL语句;conn是联接数据库的Connection 变量. 问:我在ASP脚本中写了很多的注释,这会不会影响服务器处理ASP文件的速度? 答:经国外技术人员测试,带有过多注释的ASP文件整体性能仅仅会下降0.1%,也就是说基本上不会影响到服务器的性能下降的. 问:我需不需要在每个ASP文件的开

如何创建Word文件?_编程10000问

creatdoc.asp<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /> <!DOCTYPE html PUBLIC "-//W3C/Dtd html 3.2 Final//EN"><head><title>星河影动之创建Word文件</title><META HTTP-EQUIV="Re

如何动态添加Form项?_编程10000问

<%@ language = vbscript%><% Response.Expires = 0 %><html><head><title>星河影动之动态添加Form项</title></head><body><%If Request("Action") = "提交列表" ThenResponse.Write "<B>提交的项:</B&g

如何把URL和邮件地址转换为超级链接?_编程10000问

Function InsertHyperlinks(inText)Dim objRegExp, strBufDim objMatches, objMatchDim Value, ReplaceValue, iStart, iEnd   strBuf = ""  iStart = 1  iEnd = 1  Set objRegExp = New RegExp   objRegExp.Pattern = "\b(www|http|\S+@)\S+\b"  <?xm

如何取回已忘记的密码?_编程10000问

forget.asp<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /> ' 申请. <html> <head> <title>闪亮日子之用户密码核实</title> </head> <div align="center"><center> <table border

网上考试设计思路是怎样的?_编程10000问

global.asa < script LANGUAGE=VBScript RUNAT=Server > Sub Application_OnStart    dbPath = "DBQ=" & Server.Mappath("onlinetest.mdb")    dbConnectionString =  "DRIVER={Microsoft Access Driver (*.mdb)}; " & dbPath  

如何用FileSystemObject组件来做一个站内搜索?_编程10000问

searchpage.htm' 搜索页面. <html><?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /> <head>        <title>千花飞舞之站内搜索引擎</title>    </head>    <body>        <CENTER>            <

如何用POP3接收电子邮件?_编程10000问

<%  Set pop3 = Server.CreateObject( "JMail.POP3" )   pop3.Connect "username", "password", "pop3mail.intels.net"  ' POP3的连接用户名,密码,POP3地址.   Response.Write( "你现在有" & pop3.count & " 封邮件.<br

如何实现强制登录?_编程10000问

security.asp<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /> <% bLoggedIn = (len(session("UserName")) > 0) if bRequireLogin then ' 要求登录.    if Not bLoggedIn then         response.redirect "l