<%Option Explicit%> <% Response.Buffer = True Response.ExpiresAbsolute = Now() - 1 Response.Expires = 0 Response.CacheControl = "no-cache" dim testing,phys,dbPath,q,testStr,uname, comment,theDate,testsql,objConn,objRS,sql,counter,num,backcol,theComment %> <% 'check for a cookie dim admin admin = Request.Cookies("admin") if Len(admin) <> 0 Then admin = true end if %>
<% testing = 0 phys = Request.ServerVariables("APPL_PHYSICAL_PATH") if testing = 1 then dbPath = phys & "offworld\cubensis\site\cgi-bin\cubensis.mdb" else dbPath = phys & "cgi-bin\cubensis.mdb" end if ' ADO constants used in this page const adOpenForwardOnly = 0 const adLockReadOnly = 1 const adCmdTableDirect = &H0200 const adUseClient = 3 dim connStr,rs connStr = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & dbPath set rs = Server.CreateObject("ADODB.Recordset") rs.PageSize = 10 rs.CacheSize = 500 rs.CursorLocation = adUseClient sql = " select * from guestbook order by guestbook.id desc " rs.Open sql, connStr, adOpenForwardOnly, adLockReadOnly if Len(Request("pagenum")) = 0 then rs.AbsolutePage = 1 else if CInt(Request("pagenum")) <= rs.PageCount then rs.AbsolutePage = Request("pagenum") else rs.AbsolutePage = 1 end if end if dim abspage, pagecnt abspage = rs.AbsolutePage pagecnt = rs.PageCount if not rs.EOF then response.Write "" response.write "" response.write "
Viewing Page: " & rs.AbsolutePage & " of " & rs.PageCount & "   -  Total number of comments: " & rs.RecordCount & "  

" dim fldF, intRec response.write "" response.Write "" & vbcrlf elseif abspage => pagecnt then response.write "Last Page" response.write "" & vbcrlf else response.write "No records found!" end if end if response.write "
Post New Comment   " if abspage > 1 then response.Write "First Page " else response.write "First Page | " end if if abspage = 1 then response.write "Previous Page | " else response.write "Previous Page | " end if if abspage < pagecnt then response.Write "Next Page | " else response.write "Next Page | " end if if abspage < pagecnt then response.Write "Last Page
" ' --------------------------------------------------------------------------------------------------------- dim backcol2 backcol2 = "white" response.write "" response.write "" for intRec=1 to rs.PageSize if not rs.EOF then dim testeaddy,emailString counter = counter+1 num= counter mod 2 'color every other line a different color if num then backcol = "#96BFFD" else backcol="#B1CFFD" end if 'response.Write "" response.write "" & vbcrlf dim userEmail,userHomepage, uloc uname = rs("uname").value uname = Capitalize(uname) uloc = rs("uloc").value uloc = Capitalize(uloc) if rs("eaddy").value <> "0" then userEmail = "
email:" & rs("eaddy").value & "    " if rs("homepage").value <> "0" then userHomepage = "homepage:" & rs("homepage").value & "" response.write "" if admin = true then 'response.write "" response.write "" end if rs.MoveNext end if userEmail="" userHomepage="" next response.write "
" & rs("comment").value & "
 by: " & uname & " from " & uloc & " on " & rs("theDate").value & userEmail & userHomepage & "
 [ edit ]     [ delete ]
 [ edit ]     [ delete ]     [IP = " & rs("IPAddress").value & "]
" ' --------------------------------------------------------------------------------------------------------- response.write "" response.Write "" & vbcrlf elseif abspage => pagecnt then response.write "Last Page" response.write "" & vbcrlf else response.write "No records found!" end if response.write "
Post New Comment   " if abspage > 1 then response.write "First Page | " else response.write "First Page | " end if if abspage = 1 then response.Write "Previous Page | " else response.write "Previous Page | " end if if abspage < pagecnt then response.Write "Next Page | " else response.write "Next Page | " end if if abspage < pagecnt then response.write "Last Page
" ' --------------------------------------------------------------------------------------------------------- rs.Close set rs = nothing %>
<% Function Capitalize(str) Dim t,i t = str if t <> "" then t = UCase(Mid(t, 1, 1)) & Right(t, Len(t) - 1) for i = 1 To Len(t) - 1 If Mid(t, i, 2) = Chr(13) + Chr(10) Then ' Capitalize words preceded by carriage return plus linefeed combination. t = Mid(t, 1, i) & UCase(Mid(t, i + 2, 1)) & Mid(t, i+3, Len(t)) end If if Mid(t, i, 1) = " " Then ' Capitalize words preceded by a space: t = Mid(t, 1, i) & UCase(Mid(t, i + 1, 1)) & Mid(t, i+2, Len(t)) end If Next end if Capitalize = t End Function %>