% @ 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 = "
" & 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 & "
" '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"))_
& "
"
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
%>