<% setLocale server_locale sdd = dd(objConn) If Len(Request("T1")) > 0 then strPattern = Request("T1") strPattern = Replace(strPattern, chr(34), "") strTarget = CStr(Request("D1")) Select Case strTarget Case "1" strSearch = "WHERE referer LIKE '%" & sq(strPattern) & "%'" Case "2" strSearch = "WHERE uagent LIKE '%" & sq(strPattern) & "%'" Case "3" strSearch = "WHERE IP = '" & sq(strPattern) & "'" End Select If strPattern = "*" then strSearch = "WHERE referer = ''": strTarget = "1" End If strDelStat = "WHERE " & tablPfx & "HitLog.hitDate < " & sdd & ConvDate(Now - 30) & sdd If Len(Request.Form("B1")) > 0 then Select Case Request.Form("B1") Case "Reset Counter and Statistics" objConn.Execute("UPDATE " & tablPfx & "Counter SET hitcounter = 0;") End Select strDelStat = Empty End If If Not Sess_Array(48) = Session.SessionID then UpdateSessions False Response.Redirect "default.asp" End If Dim totalPage, totalRecords, displayRecords objConn.Execute("DELETE FROM " & tablPfx & "HitLog " & strDelStat & ";") strSQLCounter = "SELECT hitcounter FROM " & tablPfx & "Counter;" Set rsCounter = objConn.Execute(strSQLCounter) If not rsCounter.EOF then iCount = rsCounter(0): Else: iCount = 0 rsCounter.close Set rsCounter = Nothing strSQLLog = "SELECT hitDate FROM " & tablPfx & "HitLog ORDER BY hitDate DESC;" Set rsLog = objConn.Execute(strSQLLog) tCount = 0 tBase = Now - 1 wCount = 0 wBase = Now - 7 mCount = 0 mBase = Now - 30 If Not rsLog.EOF then rsdata = rsLog.getrows rsLog.close For m = 0 to UBound(rsdata,2) nextDate = rsdata(0, m) If CDate(nextDate) > tBase then tCount = tCount + 1 If CDate(nextDate) > wBase then wCount = wCount + 1 If CDate(nextDate) > mBase then mCount = mCount + 1 Next Else: rsLog.close End If set rsLog = Nothing iCount = adZeros(iCount, 7) tCount = adZeros(tCount, 4) wCount = adZeros(wCount, 4) mCount = adZeros(mCount, 5) Function adZeros(param, n) Do while Len(param) < n param = "0" & param Loop adZeros = param End Function %>
Visits Log

<%= msg %>
 Hit Counter:
<%= iCount %>
In the past 24 hours:
<%= tCount %>
In the past 7 days:
<%= wCount %>
In the past 30 days:
<%= mCount %>



<% strSQLLog = "SELECT * FROM " & tablPfx & "HitLog " & strSearch & " ORDER BY hitDate DESC;" set rs = objConn.Execute(strSQLLog) If rs.EOF then Response.Write "
No statistics available yet.
" Else: nPage = Sess_Array(16) URLlink = "admin_logs.asp?" & Server.URLEncode(Request.Querystring) pageType = 12 strPaging = buildPages(nPage, URLlink, pageType) '## paging built in libraries.asp Response.Write strPaging Response.Write "
Total Pages: " & totalPage & "
" Response.Write "Listed Visits: " & totalRecords & "
" Call Build_List_Top("center", "99%", "xl_list") %> <% setLocale resetLocale For J = 1 to displayRecords If rs.EOF Then Exit For Else hitDate = rs(1) hitIP = rs(2) hitlink = rs(3) uagent = rs(4) If hitlink = Empty then hitlink = NA Else If Len(hitlink) > 50 then linktext = Left(hitlink, 50) & " ...": Else linktext = hitlink hitlink = "" & linktext & "" End If If J mod 2 = 0 then cellColor = "class='evencell'": Else: cellColor = "class='oddcell'": End If Response.Write "" Response.Write "" rs.MoveNext End If Next Response.Write "
Date: IP Address: Referrer: User Agent:
" & hitDate & "" & hitIP & "" & hitlink & "" & uagent & "
" Call Build_List_Bottom() End If rs.close %>
Search Log for a specific pattern: in
Note: The log is self-maintained. Statistics data is cleared when older than 1 month.
 Hit counter is not modified during this process.