Sign the
Guestbook |
| |
<%=sGBHeadingFont%>Guest<%=sGBHeadingFontEnd%> |
<%=sGBHeadingFont%>Comments<%=sGBHeadingFontEnd%> |
<%=sGBHeadingFont%>Date<%=sGBHeadingFontEnd%> |
|
<%
Dim nPageNo
Dim oRs
Dim oCmd
Dim myconn
if Request.QueryString("pageno") then
nPageNo = CInt(Request.QueryString("pageno"))
else
nPageNo = 1
end if
Set oRs = Server.CreateObject("ADODB.Recordset")
Set myconn = GetConnection("passwords/")
Set oCmd = Server.CreateObject("ADODB.Command")
Set oCmd.ActiveConnection = myconn
oCmd.CommandType = 1
oCmd.CommandText = "SELECT GuestbookID, UserName, UserCompany, UserURL, Date, Comments FROM Guestbook WHERE Status=2 ORDER BY Date DESC"
oRs.Open oCmd
Dim nRecordCount
if oRs.RecordCount <> -1 then
nRecordCount = oRs.RecordCount
else
nRecordCount = GetGuestbookActiveCount()
end if
fMaxPages = nRecordCount / nMaxPerPage
nMaxPages = Int(fMaxPages)
if fMaxPages <> nMaxPages then
nMaxPages = nMaxPages + 1
end if
if not oRs is NOTHING and not oRs.eof then
' skip ahead?
if nPageNo > 1 then oRs.Move((nPageNo-1) * nMaxPerPage)
width = "250"
row = 0
col = 0
bDone = false
do while not oRs.eof and not bDone
Dim sURL
Dim sURLName
sURL = oRs("UserURL")
sURLName = sURL
if (InStr(sURL, "://")) Then
sURLName = Right(sURL, (Len(sURL) - InStr(sURL, "://") - 2))
End If
Response.Write "| | "
Response.Write "" & sGBGuestInfoFont
Response.Write oRs("UserName") & " " & oRs("UserCompany") & " "
Response.Write "" & sURLName & "" & sGBGuestInfoFontEnd & " | "
Response.Write "" & sGBCommentsFont
Response.Write Left(oRs("Comments"), 150)
if (Len(oRs("Comments")) > 150) then
Response.Write "..." & sGBCommentsFontEnd & sGBGuestInfoFont & ""
Response.Write "MORE" & sGBGuestBookInfoFontEnd & " | "
else
Response.Write sGBCommentsFontEnd & ""
end if
Response.Write "" & sGBGuestInfoFont
Response.Write oRs("Date") & sGBGuestInfoFontEnd & " | "
Response.Write " |
" & vbCrLf
oRs.MoveNext
row = row + 1
if row = nMaxPerPage then
bDone = true
elseif not oRs.eof then
Response.Write "| | "
Response.Write "
| |
"
end if
loop
' Pad the extra spaces
if not bDone then
bDone = false
do while not bDone
Response.Write "| | " & vbCrLf
Response.Write "" & sGBHeadingFont
Response.Write " " & sGBHeadingFontEnd & " "
Response.Write sGBGuestInfoFont & " " & " "
Response.Write " " & sGBGuestInfoFontEnd & " | "
Response.Write "" & sGBCommentsFont
Response.Write " " & sGBCommentsFontEnd & " | "
Response.Write "" & sGBGuestInfoFont
Response.Write " " & sGBGuestInfoFontEnd & " | "
Response.Write " |
" & vbCrLf
row = row + 1
if row = nMaxPerPage then
bDone = true
end if
loop
end if
else
' Write a message that the directory is empty?
end if
%>
| <% ' set guestbook page links
Response.Write "Page: "
for i=1 to nMaxPages
if i <> nPageNo then
Response.Write "" & i & " "
else
Response.Write "" & i & " "
end if
next
%> |