时间:2021-05-25
<%
sessionID = session.SessionID
timeout = 5
' 设置session保持的时间.
Conn_String = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("count.mdb")
'Conn_String = "activeUser"
' 最好设置DSN = "activeuser",因为我们需要在所有的ASP脚本中包含这个文件.
Set ConnCount =Server.CreateObject("ADODB.Connection")
ConnCount.Open Conn_String
aaa = dateadd("n", -timeout, now())
connCount.Execute ("delete * from count where postdate < #" & aaa & "#")
' 在超时后删除session.
sql0 = "select sess from count where sess='" & sessionID & "'"
' 保持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"
' 计算sessionID.
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%>人在随风起舞流连忘返!
[1]
声明:本页内容来源网络,仅供用户参考;我单位不保证亦不表示资料全面及准确无误,也不保证亦不表示这些资料为最新信息,如因任何原因,本网内容或者用户因倚赖本网内容造成任何损失或损害,我单位将不会负任何法律责任。如涉及版权问题,请提交至online#300.cn邮箱联系删除。
Global.asa:Firstofall,whatisaglobal.asa?It'sanoptionalscriptfilethatholdscertain
本文利用asp和JMAIL实现了发送邮件,大家是不是很好奇这到底是怎么实现的呐,和小编一起一探究竟吧!Global.asa文件什么是Global.asa文件?它
下面我来向大家介绍Global.asa文件的使用方法。 什么是Global.asa文件?它其实是一个可选文件,程序编写者可以在该文件中指定事件脚本,并声明具有
'设置好global.asa文件,如下:SubApplication_OnStartApplication("ActiveUsers")=0'设置计数初始值,可
首先要设置好global.asa文件,如下以下内容为程序代码subapplication_onstartapplication("activeusers")=0