|
|
|
7i24.Com不停为您服务 准确统计在线用户数量!
下面的程序是目前最快速最有效的在线用户数量统计!
'首先要设置好global.asa 文件,如下
<SCRIPT LANGUAGE="VBScript" RUNAT="Server">
Sub Application_OnStart
' Set our user count to 0 when we start the server
Application("ActiveUsers") = 0
End Sub
Sub Session_OnStart
' Change Session Timeout to 20 minutes (if you need to)
Session.Timeout = 20
' Set a Session Start Time
' This is only important to assure we start a session
Session("Start") = Now
' Increase the active visitors count when we start the
session
Application.Lock
Application("ActiveUsers") = Application
("ActiveUsers") + 1
Application.UnLock
End Sub
Sub Session_OnEnd
' Decrease the active visitors count when the session ends.
Application.Lock
Application("ActiveUsers") = Application
("ActiveUsers") - 1
Application.UnLock
End Sub
</SCRIPT>
'---------------其它显示在线用户数量的页面--------------------
<%@ Language=VBScript %>
<HTML>
<HEAD>
<TITLE>Active Sessions</TITLE>
</HEAD>
<BODY>
<B><FONT COLOR="#CC0000"><%= Application("ActiveUsers") %></FONT>
Active Users</B>
</BODY>
</HTML>
|
|
|