<% @ LANGUAGE="VBSCRIPT" %> <% OPTION EXPLICIT DIM L_Guestbook, count, CursorType, intMID,objConn ,rst, strProvider, strQuery, StrSort L_Guestbook = "Guest Book" ' $Date: 10/20/97 4:17p $ ' $ModTime: $ ' $Revision: 17 $ ' $Workfile: guestbk.asp $ If request.QueryString("message") <> "" Then intMID = request.QueryString("message") End If If request.Form("MessageID") <> "" Then intMID = request.Form("MessageID") End If If request.Form("next") <> "" OR request.Form("prev") <> "" Then Set rst = Session("rst") If request.Form("next") <> "" Then rst.MoveNext intMID = rst("MessageID") ElseIf request.Form("prev") <> "" Then rst.MovePrevious intMID = rst("MessageID") End If Else If intMID <> "" Then count = request.Querystring("Count") - 1 Set rst = Session("rst") rst.MoveFirst rst.Move count Else call setVariables strProvider="Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("\iisadmin") & "\website\messages.mdb;" Set rst = Server.CreateObject("ADODB.recordset") rst.CursorType = 3 rst.CursorLocation = 3 rst.LockType = 3 rst.Open strQuery, strProvider Set Session("rst") = rst End If End If %> Guest Book <% call stylesheet Function Title( n) DIM strTitle DIM H If n <> "" AND Len(n) > 6 then H = 2 Else H = 1 End If strTitle = "" If n <> "" Then strTitle = strTitle & MyInfo.Name & "'" If right(myInfo.Name, 1) <> "s" then strTitle = strTitle & "s " End If End If strTitle = strTitle & L_Guestbook strTitle = strTitle & "" Title = strTitle End Function Sub Build_Table Dim strTable, num, field(), fieldname(5), sort(3) fieldname(0) = "Date:" fieldname(1) = "Name:" fieldname(2) = "Email:" fieldname(3) = "Homepage:" fieldname(4) = "Subject:" fieldname(5) = "Message:" num=0 strTable = "" If rst.EOF Then response.Write "There are no entries in the guest book" ElseIf intMID <> "" Then REDIM field(6) field(0) = rst("MessageDate") field(1) = rst("MessageFrom") field(2) = rst("Email") field(3) = rst("URL") field(4) = rst("MessageSubject") field(5) = rst("MessageBody") field(6) = rst("MessageID") Dim cell_left, cell_right, row_break cell_left = "" cell_right = "" row_break = "" For num = 0 to 5 strTable = strTable & cell_right & "" & fieldname(num) & "" If num = 2 then strTable = strTable & cell_left & "" & field(num) & "" & row_break Else strTable = strTable & cell_left & field(num) & "" & row_break End If Next num=0 Else sort(0) = "sort by date" sort(1) = "sort by author" sort(2) = "sort by subject" For num = 0 to 2 strTable = strTable & "" Next num = 0 strTable = strTable & "" count = 1 Do UNTIL rst.EOF strTable = strTable & "" strTable = strTable & "" & rst("MessageDate") & "" strTable = strTable & "" & rst("MessageFrom") & "" strTable = strTable & "" & rst("MessageSubject") & "" num = 0 strTable = strTable & "" 'break the row rst.MoveNext count = count + 1 Loop End If response.write strTable End Sub ' *** Creates input buttons. Function FormSubmit( t, name, value ) Dim btnSubmit btnSubmit = "" FormSubmit = btnSubmit End Function Sub navigationButtons If intMID <> "" Then response.write "" rst.MovePrevious If not rst.BOF Then response.write FormSubmit("SUBMIT", "prev", "<<") Else response.write "    " End If rst.MoveNext response.write " " rst.MoveNext If not rst.EOF Then response.write FormSubmit("SUBMIT", "next", ">>") Else response.write "   " End If rst.MovePrevious response.write FormSubmit("HIDDEN", "MessageID", rst("MessageID"))_ & ""_ & "Return to the " & L_Guestbook & "
" Else response.write "" End If response.write "Click here to sign the guest book
"_ & "Return to the home page"_ & "" End Sub Sub setVariables strQuery ="SELECT * FROM messages WHERE MessagePrivate = 0" StrSort = request.form("sort") Select Case StrSort Case "sort by author" StrSort = "MessageFrom" Case "sort by subject" StrSort = "MessageSubject" Case Else StrSort = "MessageDate DESC" End Select strQuery= strquery & " ORDER BY " & StrSort End Sub %>
<% call navigationButtons %>
 

<% response.write Title(myinfo.Name) %>

<% call Build_Table %>