Discussion Forums

<% If Request("MessageID") = "" Then ' We don't have a valid MessageID, so go back to the main page Response.Redirect "default.asp" End If Dim DB, rsMessage, rsInReply, rsReplies Set DB = Connect (ForumMDB) Set rsMessage = DB.Execute ("SELECT * FROM Messages WHERE MessageID = " & Request ("MessageID")) If rsMessage.EOF And rsMessage.BOF Then ' We could not find the message with the ID requested. ' There's some error : Either the administrator has deleted the message, ' or the user has linked to an invalid MessageID. ShowError "Invalid Message Identifier. Please re-login to continue." End If rsMessage.MoveFirst If rsMessage("InReplyTo") <> 0 Then ' InReplyTo <> 0 means that this IS in reply to some message. ' So find out the message for which this is the reply. Set rsInReply = DB.Execute ("SELECT * FROM Messages WHERE MessageID = " & rsMessage("InReplyTo")) End If ' Now, find out all the messages that are in reply to this message. Set rsReplies = DB.Execute ("SELECT * FROM Messages WHERE InReplyTo = " & rsMessage("MessageID")) %>
<% If rsMessage("InReplyTo") <> 0 Then %> <% End If %>
"><%= rsMessage("Subject") %> From:
<%= rsMessage("PostedBy") %>

<%= Replace(Server.HTMLEncode(rsMessage("Body")), vbCrLf, "
" + vbCrLf) %>

This message is a Reply to: "><%= rsInReply("Subject") %> from <%= rsInReply("PostedBy") %>

Replies to this message:
<% If (rsReplies.BOF And rsReplies.EOF) Then Response.Write "-None-" Else rsReplies.MoveFirst Response.Write "

    " While Not rsReplies.EOF Response.Write "
  • " & rsReplies("Subject") & "" & " by " & rsReplies("PostedBy") rsReplies.MoveNext Wend Response.Write "
" End If %>