⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 count.asp

📁 这是一个XML记数器,可用做网页设计中计数器无需解压密码
💻 ASP
字号:
<%
'=========================================================
' 名称:e-Count XML记数器
' 版本:1.0
' 日期:2003-4-17
' 编写:天煞孤星
' 信箱:xfclub@163.com
' 网址:http://www.xfok.com
'=========================================================
' 其他程序:
' e-News(商业):http://www.xfok.com/news
' e-Search(商业):http://www.xfok.com/search
' e-Article(免费):http://www.xfok.com/article
'=========================================================
const vstime=1   '记数间隔时间(单位:分钟)
dim CountFile
CountFile=server.mappath("count.xml")
dim alldata(8)
getalldata()

if alldata(3)="" then
   restart()
end if

dim lasttime,stime
lasttime=request.cookies("e-Count")("lasttime")
if lasttime="" then
   response.cookies("e-Count")("lasttime")=now()
else
   stime=datediff("n",lasttime,now())
end if

'总访问量(0),今日访问量(1),昨日访问量(2),开始统计日期(3),统计天数(4),平均日访问量(5)
'最高日访问量(6),发生日期(7),最后统计日期(8)"

if stime>=vstime then
   dim visitCount,visitCount_today
   visitCount=alldata(0)
   visitCount_today=alldata(1)
   Write "今日访问量,总访问量",visitCount_today+1&","&visitCount+1
   response.cookies("e-Count")("lasttime")=now()

   if cdate(alldata(8))<>date then
      write "最后统计日期,昨日访问量,今日访问量,平均日访问量,统计天数",date()&","&visitCount_today&",0,"&int(visitCount/alldata(4))&","&cint(alldata(4))+1
   end if

   if clng(alldata(6))<clng(visitCount_today) then
      write "最高日访问量,发生日期",visitCount_today+1&","&date()
   end if
end if

dim outstr
outstr="<a href=javascript:openScript('inc/count.xml',300,192) title='总访问量:"&alldata(0)&" - 今日访问量:"&alldata(1)&" - 昨日访问量:"&alldata(2)&"'>" & alldata(0) & "</a>"
response.write "document.write("""&outstr&""")"

Function Write(strfield,strvalue)
   Dim objXml,objRoot,i,field,value
   Set objXml = Server.createobject("microsoft.xmldom")
   objXml.async = false
   objXml.load(CountFile)
   field=split(strfield,",")
   value=split(strvalue,",")
   
   for i=0 to ubound(field)
   Set objRoot = objXml.selectSingleNode("记数器/"&field(i))
   objRoot.text=value(i)
   next

   objXml.save(CountFile)
   set objRoot=nothing
   Set objXml=nothing
end Function

Function Getalldata()
   Dim Objxml,objroot,i
   Dim Nodeattrname,objfield
   Set Objxml=server.createobject("microsoft.xmldom")
   Objxml.async=false
   Objxml.load (countfile)
   Set Objroot=objxml.selectsinglenode("记数器")
   For I=0 To 8
	   Alldata(i)=objroot.childnodes(i).text
   Next
   Set Objroot=nothing
   Set Objxml=nothing
End Function

Function ReStart()
   Dim objXml,objRoot,i,arrRestart
   Set objXml = Server.createobject("microsoft.xmldom")
   objXml.async = False
   objXml.load(CountFile) 
   arrRestart=split("0,0,0,"&date()&",1,0,0,"&date()&","&date(),",")
   Set objRoot = objXml.selectSingleNode("记数器")
   total = objRoot.childnodes.length
   for i=0 to 8
       objRoot.childnodes(i).text=arrRestart(i)
   next
   objXml.save(CountFile)
   set objRoot=nothing
   Set objXml=nothing
end Function
%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -