% Option Explicit %> <% 'Set the response buffer to true as we maybe redirecting Response.Buffer = True '___________________________________________________________________________________________ 'Dimension variables Dim rsForum 'Holds the Recordset for the forum details Dim rsGetCategoryName 'Hols the Recordset for the Category Namew Dim rsTopicDetails 'Holds the Recordset for the Topic Count Dim rsTopic 'Holds the Recordset for the Topic details Dim intForumID 'Holds the forum ID number Dim intCategoryID 'Holds the Category ID number Dim strForumName 'Holds the forum name Dim strCategoryName 'Holds the Category Name Dim lngNumberOfReplies 'Holds the number of replies for a topic Dim lngTopicID 'Holds the topic ID Dim strSubject 'Holds the topic subject Dim strTopicStartUsername 'Holds the username of the user who started the topic Dim lngTopicStartUserID 'Holds the users Id number for the user who started the topic Dim lngNumberOfViews 'Holds the number of views a topic has had Dim lngLastEntryMessageID 'Holds the message ID of the last entry Dim strLastEntryUsername 'Holds the username of the last person to post a message in a topic Dim lngLastEntryUserID 'Holds the user's ID number of the last person to post a meassge in a topic Dim dtmLastEntryDate 'Holds the date the last person made a post in the topic Dim intRecordPositionPageNum 'Holds the recorset page number to show the topics for Dim intTotalNumOfPages 'Holds the total number of pages in the recordset Dim intRecordLoopCounter 'Holds the loop counter numeber Dim intTopicPageLoopCounter 'Holds the number of pages there are in the forum Dim intLinkPageNum 'Holss the page number to link to Dim intShowTopicsFrom 'Holds when to show the topics from Dim strShowTopicsFrom 'Holds the display text from when the topics are shown from Dim blnForumLocked 'Set to true if the forum is locked Dim blnTopicLocked 'set to true if the topic is locked Dim intPriority 'Holds the priority level of the topic Dim intNumberOfTopicPages 'Holds the number of topic pages Dim intTopicPagesLoopCounter 'Holds the number of loops '___________________________________________________________________________________________ '___________________________________________________________________________________________ 'Read in the Forum ID to display the Topics for intForumID = CInt(Request.QueryString("FID")) intCategoryID = CInt(Request.QueryString("CID")) 'If there is no Forum ID to display the Topics for then redirect the user to the main forum page If intForumID = 0 Then Response.Redirect "Default.asp" If intCategoryID = 0 Then Response.Redirect "Default.asp" 'If this is the first time the page is displayed then the Forum Topic record position is set to page 1 If Request.QueryString("PP") = "" OR Request.QueryString("PP") = 0 Then intRecordPositionPageNum = 1 'Else the page has been displayed before so the Forum Topic record postion is set to the Record Position number Else intRecordPositionPageNum = CInt(Request.QueryString("PP")) End If '___________________________________________________________________________________________ '___________________________________________________________________________________________ 'recordset to get the forum details Set rsForum = Server.CreateObject("ADODB.Recordset") strSQL = "SELECT Forum.Forum_name, Forum.Password, Forum.Forum_code, " strSQL = strSQL & "Forum.Locked FROM Forum WHERE Forum_ID = " & intForumID & ";" rsForum.Open strSQL, strCon If NOT rsForum.EOF Then strForumName = rsForum("Forum_name") 'Read in wether the forum is locked or not blnForumLocked = CBool(rsForum("Locked")) 'If the forum requires a password and a logged in forum code is not found on the users machine then send them to a login page If NOT rsForum("Password") = "" and NOT Request.Cookies("PrForum")("Forum" & intForumID) = rsForum("Forum_code") Then 'Reset Server Objects Set adoCon = Nothing Set strCon = Nothing Set rsForum = Nothing 'Redirect to a page asking for the user to enter the forum password Response.Redirect "forum_password_form.asp?RP=Topic&FID=" & intForumID End If End If '___________________________________________________________________________________________ '___________________________________________________________________________________________ 'recordset to get the name of the category from the catageory table Set rsGetCategoryName = Server.CreateObject("ADODB.Recordset") 'for Access.. 'strSQL = "SELECT Category.Cat_Name FROM Category INNER JOIN Forum ON Category.Cat_ID = Forum.Cat_ID where Category.Cat_ID = " & intCategoryID & ";" '___________________________________________________________________________________________ 'for Sql Server strSQL = "SELECT Category.Cat_Name FROM Forum " strSQL = strSQL & "INNER JOIN Category ON Category.Cat_ID = Forum.Cat_ID " strSQL = strSQL & "where Category.Cat_ID = " & intCategoryID & ";" '___________________________________________________________________________________________ rsGetCategoryName.Open strSQL, strCon if Not rsGetCategoryName.EOF then strCategoryName = rsGetCategoryName("Cat_name") end if 'If the forum level for the user on this forum is 2 (read only) set the forum to be locked If (intMemberSecurityLevel = 2 AND blnModerator = False AND NOT lngLoggedInUserID = 1) AND (lngLoggedInUserID > 0) Then blnForumLocked = True 'Get what date to show topics till from cookie ' If NOT Request.Cookies("show") = "" Then ' intShowTopicsFrom = CInt(Request.Cookies("show")) ' Else ' intShowTopicsFrom = 31 ' End If '___________________________________________________________________________________________ %>
| <% = strTxtWelcome & " " & strLoggedInUsername %> |
<%
'___________________________________________________________________________________________
If lngLoggedInUserID = 1 Then Response.Write vbCrLf & ""& strTxtAdmin & " |"
'___________________________________________________________________________________________
Response.Write vbCrLf & "Search |"
'___________________________________________________________________________________________
'If the user has logged in then the Logged In User ID number will not be 0 and not 2 for the guest account
If NOT lngLoggedInUserID = 0 AND NOT lngLoggedInUserID = 2 Then
'Response.Write vbCrLf & " |
") End If '___________________________________________________________________________________________ %> ") End If %> |
<%
'
)
<%
'If the topic is not allow admin moderator to lock it
' If blnTopicLocked = True Then
%>
<%
' Else
%>
<%
' End If
End If
'___________________________________________________________________________________________
%>
<% = strSubject %>
<%
'Calculate the number of pages for the topic and display links if there are more than 1 page
intNumberOfTopicPages = ((lngNumberOfReplies + 1)\intThreadsPerPage)
'If there is a remainder from calculating the num of pages add 1 to the number of pages
If ((lngNumberOfReplies + 1) Mod intThreadsPerPage) > 0 Then intNumberOfTopicPages = intNumberOfTopicPages + 1
'___________________________________________________________________________________________
'If there is more than 1 page for the topic display links to the other pages
' If intNumberOfTopicPages > 1 Then
' Response.Write(" |
<% = strTopicStartUsername %> | <% = lngNumberOfReplies %> | <% = lngNumberOfViews %> | <% Response.Write(DateFormat(dtmLastEntryDate, saryDateTimeData) & " " & strTxtAt & " " & TimeFormat(dtmLastEntryDate, saryDateTimeData)) %>
<% = strTxtBy %> <% If lngLoggedInUserID = 1 Then %> <% = strLastEntryUsername %> <% ELSE %> <% = strLastEntryUsername %> <% END IF %>
|
|
<%
'___________________________________________________________________________________________
'If there is more than 1 page of topics then dispaly the other threads
If intTotalNumOfPages > 1 Then
' Response.Write vbCrLf & " "
'Loop round to display links to all the other pages
For intTopicPageLoopCounter = 1 to intTotalNumOfPages
If intTopicPageLoopCounter = intRecordPositionPageNum Then
Response.Write vbCrLf & "" & intTopicPageLoopCounter & ""
ELSE
Response.Write vbCrLf & "" & intTopicPageLoopCounter & ""
END IF
Next
' response.Write vbCrLf & " "
End If
%>
|