不用Global.asa也能實(shí)現(xiàn)統(tǒng)計(jì)在線人數(shù)嗎?
%
sessionID = session.SessionID
timeout = 5
' 設(shè)置session保持的時(shí)間.
Conn_String = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" Server.MapPath("count.mdb")
'Conn_String = "activeUser"
' 最好設(shè)置DSN = "activeuser",因?yàn)槲覀冃枰谒械?/SPAN>ASP腳本中包含這個(gè)文件.
Set ConnCount =Server.CreateObject("ADODB.Connection")
ConnCount.Open Conn_String
aaa = dateadd("n", -timeout, now())
connCount.Execute ("delete * from count where postdate #" aaa "#")
' 在超時(shí)后刪除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"
' 計(jì)算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
%>
當(dāng)前正有%=count%>人在隨風(fēng)起舞流連忘返!
[1]
您可能感興趣的文章:- 統(tǒng)計(jì)在線人數(shù)是實(shí)時(shí)的嗎?
- 被動(dòng)式統(tǒng)計(jì)網(wǎng)站在線人數(shù)
- asp論壇在線人數(shù)統(tǒng)計(jì)研究
- 也談php網(wǎng)站在線人數(shù)統(tǒng)計(jì)
- javascript 傳統(tǒng)事件模型構(gòu)造的事件監(jiān)聽器實(shí)現(xiàn)代碼
- c#顯示當(dāng)前在線人數(shù)示例
- 封裝了一個(gè)支持匿名函數(shù)的Javascript事件監(jiān)聽器
- php+memcache實(shí)現(xiàn)的網(wǎng)站在線人數(shù)統(tǒng)計(jì)代碼
- PHP+jquery實(shí)時(shí)顯示網(wǎng)站在線人數(shù)的方法
- jsp利用application統(tǒng)計(jì)在線人數(shù)的方法
- php實(shí)現(xiàn)統(tǒng)計(jì)網(wǎng)站在線人數(shù)的方法
- ASP.NET中使用Application對象實(shí)現(xiàn)簡單在線人數(shù)統(tǒng)計(jì)功能
- php使用Session和文件統(tǒng)計(jì)在線人數(shù)
- 淺析JAVA中過濾器、監(jiān)聽器、攔截器的區(qū)別
- 利用java監(jiān)聽器實(shí)現(xiàn)在線人數(shù)統(tǒng)計(jì)