<% ' ASP 即時線上人數統計系統 V1.0 ' 適用系統 : Microsoft IIS、PWS ' 作者 : 曹祖聖 (聖哥) http://www.080.ml.org ' 版權 : 本程式可以全權使用於任何非商業性用途上,包含散播與修改。 ' 用法 : 在要顯示線上人數的地方加上 <%=UserOnLine%> ' ' 本 ASP 檔名預設為 many.asp,但是可以任意更改主檔名,使用者只需依 ' 需要更改 ... 標籤中的內容即可,另外,程式中提供下列 ' 參數供使用者自行設定,如下: ' -------------- 使用者設定值 -------------- RefreshTime = 30 '每幾秒更新一次 ' ------------------------------------------- Application.Lock If Session("UserID") = "" Then If Application("TotalUsers") = "" Then Application("TotalUsers") = 0 Application("TotalUsers") = Application("TotalUsers") + 1 Session("UserID") = Application("TotalUsers") End If Application(Session("UserID") & "LastAccess") = Timer If RefreshTime < 10 Then RefreshTime = 10 IdleTime = RefreshTime * 3 UserOnLine = 0 For I = 1 To Application("TotalUsers") If Application(I & "LastAccess") <> "" Then If Abs(Application(I & "LastAccess") - Timer) < IdleTime Then UserOnLine = UserOnLine + 1 Else Application(I & "LastAccess") = "" End If End If Next Application.UnLock %> banner

目前站上人數:<%=UserOnLine%>