快精灵印艺坊 您身边的文印专家
广州名片 深圳名片 会员卡 贵宾卡 印刷 设计教程
产品展示 在线订购 会员中心 产品模板 设计指南 在线编辑
 首页 名片设计   CorelDRAW   Illustrator   AuotoCAD   Painter   其他软件   Photoshop   Fireworks   Flash  

 » 彩色名片
 » PVC卡
 » 彩色磁性卡
 » 彩页/画册
 » 个性印务
 » 彩色不干胶
 » 明信片
   » 明信片
   » 彩色书签
   » 门挂
 » 其他产品与服务
   » 创业锦囊
   » 办公用品
     » 信封、信纸
     » 便签纸、斜面纸砖
     » 无碳复印纸
   » 海报
   » 大篇幅印刷
     » KT板
     » 海报
     » 横幅

不用GLOBAL.ASA实现在线人数统计

<%
\\\'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
返回类别: 教程
上一教程: 献给学习XMLHTTP的朋友
下一教程: ASP深度揭密(上)

您可以阅读与"不用GLOBAL.ASA实现在线人数统计"相关的教程:
· 不用GOLOBAL.ASA和SESSION实现在线人数统计
· 不用GOLOBAL和SESSION实现在线人数统计
· 如何实现网页在线人数统计
· 用ASP设计网站在线人数统计程序
· 网页在线人数统计的做法
    微笑服务 优质保证 索取样品