% 'retrieve querystring variables Dim ForumID, ThreadID Dim cookieName, cookieEmail Dim messageType ' this decides if the message is a reply or a new post ForumID = Request.QueryString("forum_id") IF ForumID = "" then Response.Redirect "default.asp" ThreadID = Request.QueryString("thread_id") 'values to fill the textboxes with. makes it more user-friendly cookieName = Request.Cookies("name") cookieEmail = Request.Cookies("email") Dim strSQL Dim rstForumName Dim ForumName Dim conForum 'open a connection Set conForum = Server.CreateObject("ADODB.Connection") conForum.Open sConnection 'Get the forum Name Set rstForumName = conForum.Execute("Select * From tblForums Where forum_id=" & ForumID & ";") ForumName = rstForumName("ForumName") rstForumName.Close Set rstForumName = NOTHING Dim Subject, pageTitle, navBar If IsNull(ThreadID) or ThreadID = "" then Subject = "" pageTitle = sSiteName & " > " & ForumName & " > " & "Post New Thread" 'find out the next number for the thread ID, since this is a 'new thread (no thread_id was detected in the querystring) Dim rstThread Set rstThread = conForum.Execute("SELECT Max(thread_id) as LargeThread FROM tblMessages;") IF rstThread.EOF and rstThread.BOF THEN ThreadID = 1 ELSE rstThread.MoveFirst ThreadID = rstThread.Fields("LargeThread") + 1 END IF rstThread.Close Set rstThread = NOTHING if ThreadID = "" then ThreadID = 1 navBar = "
" navBar = navBar & "" &sSiteName& " > " &ForumName& " > Post New Thread >
" Else 'get the subject from database 'ThreadID stays the same as what was gathered from querystring Dim rstSubject Set rstSubject = conForum.Execute("SELECT thread_id, message_subject From tblMessages Where thread_id=" &ThreadID& ";") Subject = rstSubject("message_subject") rstSubject.Close Set rstSubject = NOTHING pageTitle = sSiteName & " > " & ForumName & " > " & Subject & " > New Reply" navBar = navBar & "" &sSiteName& " > " &ForumName& " > " &Subject& " > Reply
" 'format the subject and include the hidden field Subject = "RE: " & Subject & "" End If if isnull(ThreadID) then ThreadID = 1 %>
|