<%@ Language=VBScript %> Page Statistics <% Dim LastWeek, LastMonth, ThisDay', FmtLastWeek LastWeek = DateAdd("d", -7, Date()) 'FmtLastWeek = FormatDateTime (LastWeek, 0) LastMonth = DateAdd("d", -30, Date()) ThisDay = Date() %> Page Visits <% 'include adoCon set rs=Server.CreateObject("ADODB.Recordset") 'select unique page SQL_UniquePage = "SELECT DISTINCT Page FROM Visitor" rs.Open SQL_UniquePage, adoCon if rs.EOF then response.write "No records found" else Do While not rs.EOF Bool = Not Bool If Bool then Response.Write ("") Else Response.Write ("") End If %> <% rs.MoveNext Loop end if %>
Page Name
Hits Today
Hits Per Last 7 Days
Hits Per Last 30 Days
Hits Overall
<% Response.Write rs("Page") Dim Page Page = rs("Page") %>
<% SQL_Today = "SELECT COUNT (*) FROM Visitor WHERE Page='" & Page & "' AND VisitDate=#" & ThisDay & "#" SQL_Today2 = "SELECT COUNT (*) FROM (SELECT DISTINCT IP FROM Visitor WHERE Page='" & Page & "' AND VisitDate=#" & ThisDay & "#)" Dim Today,Today2 Set Today = adoCon.Execute(SQL_Today) Set Today2 = adoCon.Execute(SQL_Today2) Response.Write Today(0) Response.Write " (" & Today2(0) & ")" %>
<% SQL_Week = "SELECT COUNT (*) FROM Visitor WHERE Page='" & Page & "' AND VisitDate>#" & LastWeek & " 00:00:00# " SQL_Week2 = "SELECT COUNT (*) FROM (SELECT DISTINCT IP FROM Visitor WHERE Page='" & Page & "' AND VisitDate>#" & LastWeek & " 00:00:00# )" Dim Week, Week2 Set Week = adoCon.Execute(SQL_Week) Set Week2 = adoCon.Execute(SQL_Week2) Response.Write Week(0) Response.Write " (" & Week2(0) & ")" %>
<% SQL_Mnth = "SELECT COUNT (*) FROM Visitor WHERE Page='" & Page & "' AND VisitDate>#" & LastMonth & " 00:00:00# " SQL_Mnth2 = "SELECT COUNT (*) FROM (SELECT DISTINCT IP FROM Visitor WHERE Page='" & Page & "' AND VisitDate>#" & LastMonth & " 00:00:00# )" Dim Mnth, Mnth2 Set Mnth = adoCon.Execute(SQL_Mnth) Set Mnth2 = adoCon.Execute(SQL_Mnth2) Response.Write Mnth(0) Response.Write " (" & Mnth2(0) & ")" %>
<% SQL_All = "SELECT COUNT (*) FROM Visitor WHERE Page='" & Page & "' " SQL_All2 = "SELECT COUNT (*) FROM (SELECT DISTINCT IP FROM Visitor WHERE Page='" & Page & "' )" Dim All, All2 Set All = adoCon.Execute(SQL_All) Set All2 = adoCon.Execute(SQL_All2) Response.Write All(0) Response.Write " (" & All2(0) & ")" %>
<% rs.close set rs=nothing adoCon.close set adoCon=nothing %>
Note: unique visits are displayed in brackets