国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學(xué)院 > 開發(fā)設(shè)計 > 正文

不用Global.asa實現(xiàn)在線人數(shù)統(tǒng)計

2019-11-18 20:46:41
字體:
供稿:網(wǎng)友
<%
'count online user without using Global.asa
'script by Narong Khotarasakit
'webmaster of ezebox.com
'report bug : info@ezebox.com


sessionID = session.SessionID
timeout = 5
' set how long to keep this session in minute you can increase this number

Conn_String = "DRIVER={Microsoft access Driver (*.mdb)};DBQ=" & Server.MapPath("count.mdb")
'Conn_String = "activeUser"
'set your DSN = "activeuser" is a better way because you need include this file to all your asp scripts.


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

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


' keep sessionID
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

'count sessionID
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%> Active users




發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 攀枝花市| 合水县| 宕昌县| 鄂温| 长岛县| 鄂州市| 沁水县| 辽阳县| 富裕县| 怀柔区| 延庆县| 龙州县| 锦屏县| 武平县| 柯坪县| 西安市| 綦江县| 巴林右旗| 广汉市| 乌兰浩特市| 巴林左旗| 乾安县| 阳朔县| 昌宁县| 梨树县| 宜城市| 宁波市| 滁州市| 莆田市| 屯昌县| 东安县| 松溪县| 民勤县| 惠来县| 东辽县| 武定县| 石嘴山市| 安远县| 凉城县| 石家庄市| 锡林浩特市|