<% Response.Buffer = False
'Max Records to display per page
iPageSize = 25
'Double Quote
Q = Chr(34)
'Line Feed
CR = vbCrLf
'Check for first page
If Request.QueryString("page") = "" Then
iPageCurrent = 1
Else
'Not 1st page, grab page # From querystring
iPageCurrent = CInt(Request.QueryString("page"))
End If
'Do we want to show Browser details? If so Click the checkbox.
IF lCase(Request("ShowBrowserDetails")) = "on" Then
strChecked = "Checked"
ShowBrowserDetails = True
Else
strChecked = ""
ShowBrowserDetails = False
End IF
%>
<html>
<head>
<title>sitelog</title>
<META Name="ROBOTS" Content="NOINDEX, NoFollow"
</head>
<body>
<%
Set RS = Server.CreateObject("ADODB.RecordSet")
Conn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" _
& Server.MapPath("data/siteLog.mdb")
strSQL = "SELECT * FROM tblSession"
on Error Resume Next
RS.PageSize = iPageSize
RS.CacheSize = iPageSize
RS.CursorLocation = adUSeClient
RS.Open strSQL, Conn, 3, 3
'Total # of pages
iPageCount = RS.PageCount
IF iPageCount = 0 Then
Response.Write "No records found!"
Else
' Move to the selected page
RS.AbsolutePage = iPageCurrent
Response.Write "Page <B>" & iPageCurrent & "</B> of " _
& " <B>" & iPageCount & "</B> " _
& RS.RecordCount & " Total Records." & vbCrLf
%>
<Form Method="POST" Name="frmShowMoreDetails">
<font face="arial" size=1>Show Browser Details?</font>
<input type="checkBox" name="ShowBrowserDetails"
<%= strChecked %>
onClick="document.frmShowMoreDetails.submit()">
</form>
<table border=0 width="100%" cellspacing="4" cellpadding="4">
<tr bgColor="skyBlue">
<td valign="top">Referer</td>
<td valign="top" width="20%"><b>IP Address</b></td>
<td valign="top"><b>Date</b></td>
<td valign="top"><b>Time</b></td>
<td valign="top"><b>First Page</b></td>
<% IF ShowBrowserDetails = True Then %>
<td valign="top"><b>Browser</b></td>
<td valign="top"><b>Version</b></td>
<% End IF %>
</tr>
<%
'counter to keep track of record #'s displayed
iRecordsShown = 0
'Loop thru records until Page Size is reached
Do While iRecordsShown < iPageSize AND Not RS.EOF
IF RS("Referer") = "None" Then
strRef = "<b>Bookmark</b>"
Else
strRef = "<a href=" & Q & "#" & Q & " onClick=" & Q _
& "var j = window.open('" & RS("Referer") _
& "', 'newWin'); j.focus();" & Q & ">" _
& urlDecode(RS("Referer")) & "</a>"
End IF
%>
<tr bgColor="silver">
<td valign="top" width="20%" WRAP=HARD><%= strRef %></td>
<td valign="top"><b> <%= RS("UserIP") %></b></td>
<td valign="top"><b> <%= RS("Date") %></b></td>
<td valign="top"><b> <%= RS("Time") %></b></td>
<td valign="top"><b> <%= RS("HitPage") %></b></td>
<% IF ShowBrowserDetails = True Then %>
<td valign="top"><b> <%= RS("Browser") %></b></td>
<td valign="top"><b> <%= RS("UAversion") %></b></td>
<% End IF %>
</tr>
<%
RS.MoveNext
'increment counter
iRecordsShown = iRecordsShown + 1
Loop
End IF
RS.Close
Set RS = Nothing
Response.Write "</table>"
IF iPageCurrent > 1 Then
Response.Write "<input type=button " _
& "name=" & Q & "btnPrev" & Q & " " _
& "value=" & Q & "<< Previous " & Q & " " _
& "onClick=" & Q & "window.location='SiteLog.asp?page=" _
& iPageCurrent - 1 & "'" & Q & ">" & vbCrLf
End IF
If iPageCurrent < iPageCount Then
Response.Write "<input type=button " _
& "name=" & Q & "btnNext" & Q & " " _
& "value=" & Q & "Next >>" & Q & " " _
& "onClick=" & Q & "window.location='SiteLog.asp?page=" _
& iPageCurrent + 1 & "'" & Q & ">" & vbCrLf
End IF
' Function to help make the referer data a little more readable.
' Replaces urlEncoded data with it's original character
Function urlDecode(str)
str = Replace(str, "%3F", "?")
str = Replace(str, "%2F", "/")
str = Replace(str, "%7C", "|")
str = Replace(str, "%5C", "\")
str = Replace(str, "%21", "!")
str = Replace(str, "%40", "@")
str = Replace(str, "%23", "#")
str = Replace(str, "%24", "$")
str = Replace(str, "%25", "%")
str = Replace(str, "%5E", "^")
str = Replace(str, "%26", "&")
str = Replace(str, "%2A", "*")
str = Replace(str, "%28", "(")
str = Replace(str, "%29", ")")
str = Replace(str, "%7B", "{")
str = Replace(str, "%7D", "}")
str = Replace(str, "%3A", ":")
str = Replace(str, "%2E", ".")
str = Replace(str, "%2D", "-")
str = Replace(str, "%5B", "[")
str = Replace(str, "%5D", "]")
str = Replace(str, "%2C", ",")
str = Replace(str, "%3D", "=")
str = Replace(str, "%2B", "+")
str = Replace(str, "%2D", "-")
str = Replace(str, "%5F", "_")
str = Replace(str, "%7E", "~")
str = Replace(str, "%60", "`")
str = Replace(str, "%27", "'")
str = Replace(str, "%22", Chr(34))
urlDecode = str
End Function
%>
|