<%
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"))
%>