极乐门资源网 Design By www.ioogu.com

<%
sessid=session.sessionid
timeout=5 '分钟
dim conn,connstr,dbpath
dbpath="online.mdb"
'connstr="DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath(dbpath)
connstr="provider=microsoft.jet.oledb.4.0;data source="&server.mappath(dbpath)
set conn=server.createobject("adodb.connection")
conn.open connstr
'删除过期的session
aa=dateadd("n",-timeout,now())
response.write sessid&"<br />"
response.write aa
sqld="delete * from counts where postdate<#"&aa&"#"
conn.execute(sqld)

'保存id
sqlc="select sessid from counts where sessid='"&sessid&"'"
set rscheck=conn.execute(sqlc)
if rscheck.eof then
sqla="insert into counts(sessid,postdate)values('"&sessid&"','"&now()&"')"
conn.execute(sqla)
end if
rscheck.close
set rscheck=nothing

'计算人数
sqlall="select count(sessid) from counts"
set rs=conn.execute(sqlall)
countsall=rs(0)
rs.close
set rs=nothing

sql="select * from counts"
set rspredel=conn.execute(sql)
do until rspredel.eof
xxx=datediff("n",rspredel("postdate"),now())
if xxx>timeout then
countsall=countsall-1
end if
rspredel.movenext
loop
rspredel.close
set rspredel=nothing
conn.close
set conn=nothing
if countsall=0 then
countsall=1
end if
%>
当前有<%=countsall%>人

标签:
统计在线人数,,dxy

极乐门资源网 Design By www.ioogu.com
极乐门资源网 免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
极乐门资源网 Design By www.ioogu.com

评论“统计在线人数  dxy”

暂无统计在线人数  dxy的评论...