%@ LANGUAGE="VBSCRIPT" %>
<%
Option Explicit
DIM count, intMessageID, L_Dropbox, L_Guestbook, MessagePrivate, DBConn, CursorLocation, CursorType, strIDNum, cm, dateQuery, dateQueryString, fromQuery, fromQueryString, i, intMid, delete, nextCursor, nextMid, previous, location, background, MessageDateLimit, MessageDate, MessageID, MessageFromLimit, MessageFrom, MessageSubjectLimit, MessageSubject, msgprivate, objConn, objParam, rows, rowsLimit, rst, strpageType, strProvider, strQuery, StrSort, subjectQuery, subjectQueryString, tableCell, Theme
L_Dropbox = "Drop Box"
L_Guestbook = "Guest Book"
If request.QueryString("message") <> "" Then
intMessageID = request.QueryString("message")
End If
If request.Form("MessageID") <> "" Then
intMessageID = request.Form("MessageID")
End If
If request.Form("delete") <> "" OR request.Form("next") <> "" OR request.Form("prev") <> "" Then
If intMessageID <> "" Then
Set rst = Session("rst")
If request.Form("next") <> "" Then
rst.MoveNext
MessagePrivate = rst("MessagePrivate")
intMessageID = rst("MessageID")
ElseIf request.Form("prev") <> "" Then
rst.MovePrevious
MessagePrivate = rst("MessagePrivate")
intMessageID = rst("MessageID")
ElseIf request.Form("delete") <> "" Then
MessagePrivate = rst("MessagePrivate")
intMessageID = ""
rst.Delete
rst.Requery
End If
End If
Else
If request.QueryString("private") = "True" OR request.Form("private") = "True" Then
MessagePrivate = "True"
Else
MessagePrivate = "False"
End If
If intMessageID <> "" Then
Set rst = Session("rst")
rst.MoveFirst
count = request.Querystring("Count") - 1
Set rst = Session("rst")
rst.MoveFirst
rst.Move count
Else
call setVariables
call queryLimits 'Sets strQuery
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
%>
Message Center
<%
Function Title( n, p )
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
If p = "True" Then
strTitle = strTitle & L_Dropbox
Else
strTitle = strTitle & L_Guestbook
End If
strTitle = strTitle & ""
Title = strTitle
End Function
Sub buildTable
Set rst = Session("rst")
If rst.EOF Then
If intMessageID <> "" Then
response.Write "
There are no more messages.
"
ElseIf request.QueryString("MessageDateLimit") <> "" Then
response.Write "
There are no messages that meet your criteria.
"
Else
response.Write "
There are no entries in your "
If MessagePrivate = "False" Then
response.write lcase(L_guestbook)
Else
response.write lcase(L_dropbox)
End If
response.write ".
"
End If
ElseIf intMessageID <> "" Then
Dim col1Cell
Dim col5Cell
Dim colFont
col5Cell = "
"
count = count + 1
Loop
End If
End Sub
' *** Creates input buttons.
Function FormSubmit( t, name, value )
Dim btnSubmit
btnSubmit = ""
FormSubmit = btnSubmit
End Function
Sub navigationButtons
If intMessageID <> "" Then
response.write "
"
rst.MovePrevious
If not rst.BOF Then
response.write FormSubmit("SUBMIT", "prev", "<<")
End If
rst.MoveNext
response.write FormSubmit("SUBMIT", "delete", "Delete message")
rst.MoveNext
If not rst.EOF Then
response.write FormSubmit("SUBMIT", "next", ">>")
End If
rst.MovePrevious
response.write FormSubmit("HIDDEN", "MessageID", rst("MessageID"))
response.write "
"
If MessagePrivate <> "True" Then
response.write "New Query "
End If
End If
response.write "Web Site
"
End Sub
Sub setVariables
StrSort = request.form("sort")
Select Case StrSort
Case "sort by author"
StrSort = "MessageFrom"
Case "sort by subject"
StrSort = "MessageSubject"
Case Else
StrSort = "MessageDate"
End Select
MessageDateLimit = request.Form("MessageDateLimit")
MessageDate = request.Form("MessageDate")
If IsDate(MessageDate) Then
MessageDate = MessageDate
Else
MessageDate = month( now ) & "/" & day( now ) & "/" & year( now ) & " " & time()
End If
MessageFromLimit = request.Form("MessageFromLimit")
MessageFrom = request.Form("MessageFrom")
MessageSubjectLimit = request.Form("messageSubjectLimit")
MessageSubject = request.Form("messageSubject")
End Sub
Sub queryLimits
strQuery ="SELECT * FROM messages WHERE MessagePrivate =" & MessagePrivate
If MessageDate <> "" or MessageFrom <> "" or MessageSubject <> "" Then
if Hour(MessageDate) = 0 then
If MessageDate <> "" Then
If MessageDateLimit = "less than" Then
strQuery = strQuery & " AND DateValue(MessageDate) < #" & MessageDate & "#"
ElseIf MessageDateLimit = "equal to" Then
strQuery = strQuery & " AND DateValue(MessageDate) = #" & MessageDate & "#"
ElseIf MessageDateLimit = "greater than" Then
strQuery = strQuery & " AND DateValue(MessageDate) > #" & MessageDate & "#"
End If
End If
Else
If MessageDate <> "" Then
If MessageDateLimit = "less than" Then
strQuery = strQuery & " AND MessageDate < #" & MessageDate & "#"
ElseIf MessageDateLimit = "equal to" Then
strQuery = strQuery & " AND MessageDate = #" & MessageDate & "#"
ElseIf MessageDateLimit = "greater than" Then
strQuery = strQuery & " AND MessageDate > #" & MessageDate & "#"
End If
End If
End If
If MessageFrom <> "" Then
If request.form("MessageFromLimit") = "begins with" Then
strQuery = strQuery & " AND MessageFrom LIKE '" & MessageFrom & "%'"
ElseIf request.Form("MessageFromLimit") = "contains" Then
strQuery = strQuery & " AND MessageFrom LIKE '" & "%" & MessageFrom & "%'"
ElseIf request.Form("messageFromLimit") = "ends with" Then
strQuery = strQuery & " AND MessageFrom LIKE '%" & MessageFrom & "'"
ElseIf request.Form("messageFromLimit") = "equal to" Then
strQuery = strQuery & " AND MessageFrom = '" & MessageFrom & "'"
End If
End If
If MessageSubject <> "" Then
If request.form("MessageSubjectLimit") = "begins with" Then
strQuery = strQuery & " AND MessageSubject LIKE '" & MessageSubject & "%'"
ElseIf request.Form("MessageSubjectLimit") = "contains" Then
strQuery = strQuery & " AND MessageSubject LIKE '" & "%" & MessageSubject & "%'"
ElseIf request.Form("MessageSubjectLimit") = "ends with" Then
strQuery = strQuery & " AND MessageSubject LIKE '%" & MessageSubject & "'"
ElseIf request.Form("MessageSubjectLimit") = "equal to" Then
strQuery = strQuery & " AND MessageSubject = '" & MessageSubject & "'"
End If
End If
End If
strQuery= strquery & " ORDER BY " &StrSort
End Sub
%>