Discussion Forums


<% Dim DB, InReplyTo, rsInReplyTo, IsAReply Set DB = Connect (ForumMDB) If Request ("Action") = "Send Message" Then Dim rsMessage Set rsMessage = Server.CreateObject ("ADODB.Recordset") rsMessage.Open "Messages", DB, adOpenStatic, adLockPessimistic rsMessage.AddNew rsMessage ("ForumID") = Request ("ForumID") rsMessage ("PostedBy") = Request ("PostedBy") rsMessage ("Email") = Request ("Email") rsMessage ("Subject") = Request ("Subject") rsMessage ("Body") = Request ("Body") rsMessage ("InReplyTo") = Request ("InReplyTo") rsMessage ("Date") = Now rsMessage.Update Dim rsForum Set rsForum = Server.CreateObject ("ADODB.Recordset") rsForum.Open "SELECT Posts, LastPost FROM Forums WHERE ForumID = " & Request ("ForumID"), DB, adOpenStatic, adLockPessimistic rsForum ("Posts") = rsForum ("Posts") + 1 rsForum ("LastPost") = Now rsForum.Update Response.Cookies (SiteTitle)("PostedBy") = Request("PostedBy") Response.Cookies (SiteTitle)("Email") = Request("Email") Response.Redirect "forum.asp?ForumID=" & Request ("ForumID") Else InReplyTo = Request ("InReplyTo") If InReplyTo <> 0 And InReplyTo <> "" Then IsAReply = True Set rsInReplyTo = DB.Execute ("SELECT * FROM Messages WHERE MessageID = " & InReplyTo) End If If Not IsAReply And (Request ("ForumID") = "" Or Request ("ForumID") = 0) Then Response.Redirect "forum.asp" End If %>
Post a Message <% If IsAReply Then Response.Write " in reply to " & rsInReplyTo("Subject") & " by " & rsInReplyTo ("PostedBy") & ""%>
"> "> ">
From: ">
Email Address: ">
Subject: ">
Message:
 
<% End If %>