<%@LANGUAGE="VBSCRIPT" CODEPAGE="950"%> <% if(Request.ServerVariables("REMOTE_ADDR") <> "") then Command1__USR_IP = Request.ServerVariables("REMOTE_ADDR") %> <% Dim RecCount Dim RecCount_numRows Set RecCount = Server.CreateObject("ADODB.Recordset") RecCount.ActiveConnection = MM_connCounter_STRING RecCount.Source = "SELECT * FROM webCount" RecCount.CursorType = 0 RecCount.CursorLocation = 2 RecCount.LockType = 1 RecCount.Open() RecCount_numRows = 0 %> <% Dim TodayCount Dim TodayCount_numRows Set TodayCount = Server.CreateObject("ADODB.Recordset") TodayCount.ActiveConnection = MM_connCounter_STRING TodayCount.Source = "SELECT * FROM showDayCount" TodayCount.CursorType = 0 TodayCount.CursorLocation = 2 TodayCount.LockType = 1 TodayCount.Open() TodayCount_numRows = 0 %> <% if Session("countOK") <> 1 then set Command1 = Server.CreateObject("ADODB.Command") Command1.ActiveConnection = MM_connCounter_STRING Command1.CommandText = "INSERT INTO webCount (count_ip) VALUES ('" + Replace(Command1__USR_IP, "'", "''") + "')" Command1.CommandType = 1 Command1.CommandTimeout = 0 Command1.Prepared = true Command1.Execute() Session("countOK") = 1 end if %> <% ' *** Recordset Stats, Move To Record, and Go To Record: declare stats variables Dim RecCount_total Dim RecCount_first Dim RecCount_last ' set the record count RecCount_total = RecCount.RecordCount ' set the number of rows displayed on this page If (RecCount_numRows < 0) Then RecCount_numRows = RecCount_total Elseif (RecCount_numRows = 0) Then RecCount_numRows = 1 End If ' set the first and last displayed record RecCount_first = 1 RecCount_last = RecCount_first + RecCount_numRows - 1 ' if we have the correct record count, check the other stats If (RecCount_total <> -1) Then If (RecCount_first > RecCount_total) Then RecCount_first = RecCount_total End If If (RecCount_last > RecCount_total) Then RecCount_last = RecCount_total End If If (RecCount_numRows > RecCount_total) Then RecCount_numRows = RecCount_total End If End If %> <% ' *** Recordset Stats: if we don't know the record count, manually count them If (RecCount_total = -1) Then ' count the total records by iterating through the recordset RecCount_total=0 While (Not RecCount.EOF) RecCount_total = RecCount_total + 1 RecCount.MoveNext Wend ' reset the cursor to the beginning If (RecCount.CursorType > 0) Then RecCount.MoveFirst Else RecCount.Requery End If ' set the number of rows displayed on this page If (RecCount_numRows < 0 Or RecCount_numRows > RecCount_total) Then RecCount_numRows = RecCount_total End If ' set the first and last displayed record RecCount_first = 1 RecCount_last = RecCount_first + RecCount_numRows - 1 If (RecCount_first > RecCount_total) Then RecCount_first = RecCount_total End If If (RecCount_last > RecCount_total) Then RecCount_last = RecCount_total End If End If %> <% Dim RefreshTime, IdleTime, TotalUsers, OnlineUser(), Tmp(), Num, I, ID RefreshTime = 10 IdleTime = RefreshTime * 3 Application.Lock If Application(Session.SessionID & "LastAccessTime") = Empty Then If Application("TotalUsers") = Empty Then Application("TotalUsers") = 0 ReDim Tmp(Application("TotalUsers") + 1) Num = 0 If Application("TotalUsers") > 0 Then For I = LBOUND(Application("OnlineUser")) To UBOUND(Application("OnlineUser")) ID = Application("OnlineUser")(I) If ID <> Session.SessionID Then Tmp(Num) = ID Num = Num + 1 End If Next End If Tmp(Num) = Session.SessionID Application("TotalUsers") = Num + 1 ReDim Preserve Tmp(Application("TotalUsers")) Application("OnlineUser") = Tmp End If Application(Session.SessionID & "LastAccessTime") = Timer ReDim Tmp(Application("TotalUsers")) Num = 0 For I = 0 To Application("TotalUsers") - 1 ID = Application("OnlineUser")(I) If (Timer - Application(ID & "LastAccessTime")) < IdleTime Then Tmp(Num) = ID Num = Num + 1 Else Application(ID & "LastAccessTime") = Empty End If Next If Num <> Application("TotalUsers") Then ReDim Preserve Tmp(Num) Application("OnlineUser") = Tmp Application("TotalUsers") = Num End If Application.UnLock %> 武藏坊日式料理官方網站
<% RecCount.Close() Set RecCount = Nothing %> <% TodayCount.Close() Set TodayCount = Nothing %>