哪位高手帮忙看吓这代码是什么意思啊?

qvbiicel 2008-04-10 12:26:15
<%
Dim conn,connstr
on error resume next
connstr="driver={microsoft access driver (*.mdb)};dbq="&server.mappath("#Date.mdb")
'数据库连接地址
set conn=server.createobject("ADODB.CONNECTION")
conn.open connstr
dim mRs,Userip,Oto,Zday,Counter,CountemRs,Today,Daynum,Yesterday,Top,Stats,Browser
Userip = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
If Userip = "" Then Userip = Request.ServerVariables("REMOTE_ADDR")

Set mRs=Server.CreateObject("adodb.recordSet")
Sql="Select * from Counter"
mRs.open Sql,conn,1,3
Oto=mRs("Oto")

If Oto<>date() then
Zday=date()-1
application.lock
conn.Execute"Update Counter Set Today=0,Browser=0,Oto=date(),Daynum=Daynum+1,Yesterday="&mRs("Today")&""
conn.Execute"Insert into 5izt_Day(Zday,Stats,Browser) values ('"&Zday&"',"&mRs("Today")&","&mRs("Browser")&")"
application.unlock

Set mRs=Server.CreateObject("adodb.recordSet")
Sql="delete from 5izt_Ip"
mRs.open Sql,conn,1,3
mRs.close
Set mRs=nothing
Else
application.lock
conn.Execute"Update Counter Set Browser=Browser+1"

Set mRs=Server.CreateObject("adodb.recordSet")
Sql="Select * from 5izt_Ip where IP='"&Userip&"' order by Id desc"
mRs.open Sql,conn,1,3
If mRs.bof and mRs.eof then
mRs.addnew
mRs("IP")=Userip
mRs.update
conn.Execute"Update Counter Set Counter=Counter+1,Today=Today+1"
End If
mRs.close
Set mRs=nothing
application.unlock
End If
Set mRs=Server.CreateObject("adodb.recordSet")
Sql="Select * from Counter"
mRs.open Sql,conn,1,3
If mRs("Top")<mRs("Today") then
conn.Execute"Update Counter Set [Top]="&mRs("Today")&""
End If

Response.Write"document.write(""总访问:<b>"& mRs("Counter") &"</b> 次  最高IP:<b>"& mRs("Top") &"</b>  今日访问量:<b>"& mRs("Browser") &"</b>  共统计:<b>"& mRs("Daynum") &"</b> 天"");"


mRs.close
Set mRs=nothing
conn.close
Set conn=nothing
%>
...全文
51 点赞 收藏 5
写回复
5 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
zl_c 2008-04-11
唉~已经够详细的了.
回复
小逗狗 2008-04-10
<%
Dim conn,connstr
on error resume next
connstr="driver={microsoft access driver (*.mdb)};dbq="&server.mappath("#Date.mdb")
'数据库连接地址
set conn=server.createobject("ADODB.CONNECTION")
conn.open connstr
dim mRs,Userip,Oto,Zday,Counter,CountemRs,Today,Daynum,Yesterday,Top,Stats,Browser
Userip = Request.ServerVariables("HTTP_X_FORWARDED_FOR") //获取用户IP地址
If Userip = "" Then Userip = Request.ServerVariables("REMOTE_ADDR")

Set mRs=Server.CreateObject("adodb.recordSet") //打开统计数据表
Sql="Select * from Counter"
mRs.open Sql,conn,1,3
Oto=mRs("Oto")

If Oto <>date() then //判断统计表中日期是否与现在日期一致,不一致则更新表中的记录,把统计日期设为当前日期,设置今天的访问量为0,记录昨天的访问量
Zday=date()-1
application.lock
conn.Execute"Update Counter Set Today=0,Browser=0,Oto=date(),Daynum=Daynum+1,Yesterday="&mRs("Today")&"" 更新表中记录,就是上面说的
conn.Execute"Insert into 5izt_Day(Zday,Stats,Browser) values ('"&Zday&"',"&mRs("Today")&","&mRs("Browser")&")" //向日统计表中插入信息
application.unlock

Set mRs=Server.CreateObject("adodb.recordSet") //应该是清空记录IP地址的表
Sql="delete from 5izt_Ip"
mRs.open Sql,conn,1,3
mRs.close
Set mRs=nothing
Else
application.lock
conn.Execute"Update Counter Set Browser=Browser+1" //浏览量加1

Set mRs=Server.CreateObject("adodb.recordSet")
Sql="Select * from 5izt_Ip where IP='"&Userip&"' order by Id desc"
mRs.open Sql,conn,1,3
If mRs.bof and mRs.eof then //如果表中不存在当前的用户IP则添加
mRs.addnew
mRs("IP")=Userip
mRs.update
conn.Execute"Update Counter Set Counter=Counter+1,Today=Today+1" //增加一次IP访问
End If
mRs.close
Set mRs=nothing
application.unlock
End If
Set mRs=Server.CreateObject("adodb.recordSet")
Sql="Select * from Counter"
mRs.open Sql,conn,1,3
If mRs("Top") <mRs("Today") then //如果历史最高访问量小于今天的,那么把今天的访问量设为历史最高访问量

conn.Execute"Update Counter Set [Top]="&mRs("Today")&""
End If

Response.Write"document.write(""总访问: <b>"& mRs("Counter") &" </b> 次  最高IP: <b>"& mRs("Top") &" </b>  今日访问量: <b>"& mRs("Browser") &" </b>  共统计: <b>"& mRs("Daynum") &" </b> 天"");"


mRs.close
Set mRs=nothing
conn.close
Set conn=nothing
%>
回复
qvbiicel 2008-04-10
可以详细点吗?
回复
小逗狗 2008-04-10
统计当天访问的IP数的
回复
qvbiicel 2008-04-10
多谢你的回答?还用更详细的吗?
回复
相关推荐
发帖
ASP
创建于2007-09-28

2.8w+

社区成员

ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
申请成为版主
帖子事件
创建了帖子
2008-04-10 12:26
社区公告
暂无公告