统计在线人数是实时的吗?_编程10000问

global.asa<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />


<script LANGUAGE="VBScript" RUNAT="Server">

 

Sub Application_OnStart

Application("ActiveUsers") = 0

' 从0开始计起.不过你可以把它设得更多哦,这样即使没人在线,人家一来你网站还会看到有900多人在线呢.

End Sub

 

Sub Session_OnStart

Session.Timeout = 20

' 把Session超时设为30分钟——这是噱头之关键所在,你想设多少就设多少.

Session("Start") = Now

' Session 开始时间

 

Application.Lock

Application("ActiveUsers") = Application

("ActiveUsers") + 1

Application.UnLock

' 挨个儿统计真实的访问人数.

End Sub

 

Sub Session_OnEnd

 

Application.Lock

Application("ActiveUsers") = Application

("ActiveUsers") - 1

Application.UnLock

End Sub

 

</script>

 

 

 

[1]

时间: 2024-08-07 05:21:39

统计在线人数是实时的吗?_编程10000问的相关文章

不用Global.asa也能实现统计在线人数吗?_编程10000问

不用Global.asa也能实现统计在线人数吗? <%sessionID = session.SessionIDtimeout = 5' 设置session保持的时间. Conn_String = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("count.mdb")'Conn_String = "activeUser"' 最好设置DSN = &qu

如何最准确地统计在线用户数?_编程10000问

' 设置好global.asa 文件,如下:<script LANGUAGE="VBScript" RUNAT="Server"> Sub Application_OnStart      Application("ActiveUsers") = 0      ' 设置计数初始值,可以根据自己的需要哦.End Sub Sub Session_OnStart      Session.Timeout = 20<?xml:names

如何实时获知多少人在线?_编程10000问

global.asa<script LANGUAGE="VBScript" RUNAT="Server"> Sub Application_OnStart      ' Sub Application_OnStart 是好在服务器每次启动的时候激活的方法.       Session.Timeout = 3 <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:

ASP问答集_编程10000问

问:为什么我的记录集的RecordCount值总是返回-1? 答:你应当使用这种模式来打开存取数据库的记录集:   rec.open strSQL,conn,1,1   其中的strSQL是操作数据库的SQL语句;conn是联接数据库的Connection 变量. 问:我在ASP脚本中写了很多的注释,这会不会影响服务器处理ASP文件的速度? 答:经国外技术人员测试,带有过多注释的ASP文件整体性能仅仅会下降0.1%,也就是说基本上不会影响到服务器的性能下降的. 问:我需不需要在每个ASP文件的开

如何创建Word文件?_编程10000问

creatdoc.asp<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /> <!DOCTYPE html PUBLIC "-//W3C/Dtd html 3.2 Final//EN"><head><title>星河影动之创建Word文件</title><META HTTP-EQUIV="Re

如何动态添加Form项?_编程10000问

<%@ language = vbscript%><% Response.Expires = 0 %><html><head><title>星河影动之动态添加Form项</title></head><body><%If Request("Action") = "提交列表" ThenResponse.Write "<B>提交的项:</B&g

如何把URL和邮件地址转换为超级链接?_编程10000问

Function InsertHyperlinks(inText)Dim objRegExp, strBufDim objMatches, objMatchDim Value, ReplaceValue, iStart, iEnd   strBuf = ""  iStart = 1  iEnd = 1  Set objRegExp = New RegExp   objRegExp.Pattern = "\b(www|http|\S+@)\S+\b"  <?xm

如何取回已忘记的密码?_编程10000问

forget.asp<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /> ' 申请. <html> <head> <title>闪亮日子之用户密码核实</title> </head> <div align="center"><center> <table border

网上考试设计思路是怎样的?_编程10000问

global.asa < script LANGUAGE=VBScript RUNAT=Server > Sub Application_OnStart    dbPath = "DBQ=" & Server.Mappath("onlinetest.mdb")    dbConnectionString =  "DRIVER={Microsoft Access Driver (*.mdb)}; " & dbPath