ä¸ç¨Global.asaä¹è½å®ç°ç»è®¡å¨çº¿äººæ°åï¼
<%
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%>人å¨éé£èµ·èæµè¿å¿è¿!
 xml:namespace prefix = o ns = “urn:schemas-microsoft-com:office:office” /??
[1]