50分求助,一个网站计数器代码

水母在发光 2003-10-15 11:28:47
目的:通过ip地址记录,相同ip地址在三分钟之内刷新网站,计数器不变,超过三分钟,或者关闭窗口,再打开的,计数器加一

我用cookies做了n遍,怎么做也实现不了,高手帮忙啊???????????
...全文
658 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
wzgan 2003-10-15
  • 打赏
  • 举报
回复
错了
注:

你所把
Const imgpath="img"

省略了
不然就加上0 到 9 的数字图片!!

还有 count.asp是ACCESS文件
字段是counterid counter
你自己建一下就可以了

或者改counter.asp-->db1="count.asp" 为count.mdb
config.asp-->Const dbpath="count.asp" 为count.mdb
字段是counterid counter
你自己建一下就可以了




coolboy0000love 2003-10-15
  • 打赏
  • 举报
回复
up
wzgan 2003-10-15
  • 打赏
  • 举报
回复
注:

你所把
Const dbpath="count.asp"
Const imgpath="img"

省略了
不然就加上0 到 9 的数字图片!!



wzgan 2003-10-15
  • 打赏
  • 举报
回复

config.asp
------------------------------
<%
'此处改成你的网站地址
Const HostUrl= "http://www.huaying.com"
'图片文件所处位置,清空路径,如改成:Const imgpath="" 则显示文本数字
Const dbpath="count.asp"
Const imgpath="img"
'是否锁定IP,1为锁定,0为不锁定,锁定IP后在一段时间内同一IP不能刷新计数器,因此统计数字比较精确。
const iplock=1

'计数器显示位数,不足位数显示0,根据你的情况可以修改
Const countlong=8

'计数器显示初始值,在你统计时实际浏览数字要减去初始值才准确
'const firstnum=5000
%>
wzgan 2003-10-15
  • 打赏
  • 举报
回复
下面的代码贴出共享::

-------------------------------------------

counter.asp


<!--#include file="config.asp"-->
<%
dim countstr,countconn,countrs,counters,db1
'On error resume next
db1="count.asp"
Set countConn=server.createobject("ADODB.CONNECTION")
CountStr="DBQ="&Server.Mappath(""&dbpath&"")&";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
'CountStr="driver={microsoft access driver (*.mdb)};dbq=" & server.MapPath(db)
countConn.Open CountStr
Set countrs=Server.CreateObject("ADODB.recordset")
countrs.open "select * from counter where counterid=1",countconn,3,3
'锁定ip
if iplock=1 then

counters=cstr(countrs("counter"))
if session("fareastnet_counteruser")<>"fareastnet_counteruser" then
session("fareastnet_counteruser")="fareastnet_counteruser"
application.lock
call addcounters()
application.unlock
end if
else
call addcounters()
end if
countrs.close
Dim countS, counti,countnum
countS=countlong-Len(cstr(counters))
For counti = 1 to countS
if imgpath<>"" then
countnum=countnum&"<img src='"&imgpath&"/0.gif' border=0>"
else
countnum=countnum&"0"
end if
next
for counti=1 to len(cstr(counters))
if imgpath<>"" then
countnum=countnum&"<img src='"&imgpath&"/" & mid(cstr(counters),counti,1) & ".gif' border=0>"
else
countnum=countnum& mid(cstr(counters),counti,1)
end if
next
response.write "<font face='Arial, Helvetica, sans-serif'>"&countnum&"</font>"
'response.write "document.write('"&countnum&"')"
set countrs=nothing
countconn.close
set countconn=nothing
sub addcounters()
countrs("counter")=cstr(countrs("counter"))+1
countrs.update
counters=firstnum+cstr(countrs("counter"))
end sub
%>
BingGroup 2003-10-15
  • 打赏
  • 举报
回复
记录SESSION

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧