不用Global.asa实现在线人数统计_asp

  • 内容
  • 评论
  • 相关

<%
sessionID = session.SessionID
timeout = 5
Conn_String = "DRIVER={Microsoft access Driver (*.mdb)};DBQ=" & Server.MapPath("count.mdb")

Set ConnCount =Server.CreateObject("ADODB.Connection")
ConnCount.Open Conn_String

aaa = dateadd("n", -timeout, now())
connCount.Execute ("delete * from count where postdate < #" & aaa & "#")

http://www.gaodaima.com/66164.html不用Global.asa实现在线人数统计_asp

sql0 = "select sess from count where sess='" & sessionID & "'"
set rscheck = connCount.Execute (sql0)
if rscheck.eof then
sql = "insert into count (sess,postdate) values('" & sessionID & "', '" & now() & "')"
connCount.Execute (sql)
end if
rscheck.close
set rscheck = nothing

sql2 = "select count(sess) from count"
set rs = connCount.Execute (sql2)
count = rs(0)
rs.close
set rs = nothing

sql3 = "select * from count"
set rspredel = connCount.Execute (sql3)
do until rspredel.eof
xxx=DateDiff("n", rspredel("postdate"), Now())
if xxx > timeout then
count = count-1
end if
rspredel.movenext
loop
rspredel.close
set rspredel = nothing

connCount.Close
set connCount = nothing

if count = 0 then
count = 1
end if
%>
     
目前<%=count%>人在线 

欢迎大家阅读《不用Global.asa实现在线人数统计_asp》,跪求各位点评,若觉得好的话请收藏本文,by 搞代码

原创文章,转载请注明: 转载自搞代码

本文链接地址: 不用Global.asa实现在线人数统计_asp

微信支付二维码

微信 赏一包辣条吧~

支付宝支付二维码

支付宝 赏一听可乐吧~

评论

0条评论

发表评论

电子邮件地址不会被公开。 必填项已用*标注