<%@ LANGUAGE="VBScript" %> <% Option Explicit Dim sDbLocation, sConnection, sSiteName, sHomeURL ' The following are some variables that have to be ' individually customized for this website sSiteName = "Hopenet Forums" sHomeURL = "http://www.hopenetworks.org/" sDbLocation = Server.MapPath("forum.mdb") sConnection = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & sDbLocation & ";" 'ConnectDB: a simple function to make database connections FUNCTION ConnectDb () Dim conForum SET conForum = Server.CreateObject("ADODB.Connection") conForum.Open sConnection Set ConnectDb = conForum conForum.Close SET conForum = NOTHING END FUNCTION 'InputFix: Prepares Text in the proper format for inserting ' into the database. FUNCTION InputFix(strInput) Dim strTemp strTemp = Replace(strInput, "'", "`") InputFix = strTemp END FUNCTION 'OutputFix: Prepares Text in the proper format for inserting ' into the html code of a page. FUNCTION OutputFix(strInput) Dim strTemp strTemp= Replace(strInput, vbcrlf, "
") strTemp = Replace(strTemp, "`", "'") OutputFix = strTemp END FUNCTION %> <% Dim ForumNumber, ForumName Dim strSQL Dim rstMessages, rstForumName Dim conForum 'retreive the appropriate forum number ForumNumber = Request.QueryString("forumid") If ForumNumber = "" then Response.Redirect "default.asp" Set conForum = Server.CreateObject("ADODB.Connection") ConForum.Open sConnection 'retreive the parent messages strSQL = "SELECT Max(message_timestamp) as LastReply, Count(message_subject) as ReplyCount, message_subject as Subject, thread_id FROM tblMessages WHERE forum_id=" & ForumNumber & " Group BY thread_id, message_subject Order By Max(message_timestamp) DESC;" Set rstMessages = conForum.Execute(strSQL) 'Get the forum Name Set rstForumName = conForum.Execute("Select * From tblForums Where forum_id=" & ForumNumber & ";") ForumName = rstForumName("ForumName") rstForumName.Close Set rstForumName = NOTHING '=====For the alternating row colors======= Dim ColorNumber Dim RowColor ColorNumber = 0 %> forums

<%=sSiteName%> > <%=ForumName%> >

Post New Thread
<% If Not rstMessages.EOF Then %> <% Dim continue, n While continue = 0 ColorNumber = ColorNumber + 1 If (ColorNumber MOD 2) = 0 Then 'it's even RowColor = "#EEEEEE" Else RowColor = "#FFFFFF" End If %> <% n = n + 1 rstMessages.MoveNext IF rstMessages.EOF Then continue = 1 IF n = 70 Then continue = 1 %> <% Wend %>
Thread Subject Replies Latest Reply
&forum_id=<%=ForumNumber%>"><%=OutputFix(rstMessages("Subject"))%>

<%=Cint(rstMessages("ReplyCount"))-1%>

<%=rstMessages("LastReply")%>
<% Else Response.Write "There are currently no posts in this forum." End If %> <% rstMessages.Close Set rstMessages = Nothing conForum.Close Set conForum = NOTHING %>

Back to Forum List  |  Post New Thread

Search the forums for a keyword: