% @ Language=VBScript %> <% Option Explicit %> <% '**************************************************************************************** '** Copyright Notice '** '** Web Wiz Forums(TM) '** http://www.webwizforums.com '** '** Copyright (C)2001-2008 Web Wiz(TM). All Rights Reserved. '** '** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS UNDER LICENSE FROM 'WEB WIZ'. '** '** IF YOU DO NOT AGREE TO THE LICENSE AGREEMENT THEN 'WEB WIZ' IS UNWILLING TO LICENSE '** THE SOFTWARE TO YOU, AND YOU SHOULD DESTROY ALL COPIES YOU HOLD OF 'WEB WIZ' SOFTWARE '** AND DERIVATIVE WORKS IMMEDIATELY. '** '** If you have not received a copy of the license with this work then a copy of the latest '** license contract can be found at:- '** '** http://www.webwizguide.com/license '** '** For more information about this software and for licensing information please contact '** 'Web Wiz' at the address and website below:- '** '** Web Wiz, Unit 10E, Dawkins Road Industrial Estate, Poole, Dorset, BH15 4JD, England '** http://www.webwizguide.com '** '** Removal or modification of this copyright notice will violate the license contract. '** '**************************************************************************************** '*************************** SOFTWARE AND CODE MODIFICATIONS **************************** '** '** MODIFICATION OF THE FREE EDITIONS OF THIS SOFTWARE IS A VIOLATION OF THE LICENSE '** AGREEMENT AND IS STRICTLY PROHIBITED '** '** If you wish to modify any part of this software a license must be purchased '** '**************************************************************************************** Response.Buffer = True 'Make sure this page is not cached Response.Expires = -1 Response.ExpiresAbsolute = Now() - 2 Response.AddHeader "pragma","no-cache" Response.AddHeader "cache-control","private" Response.CacheControl = "No-Store" 'Dimension variables Dim sarryPosts 'Holds the posts recordset Dim strForumName 'Holds the forum name Dim strForumDescription 'Holds the description of the forum Dim strCatName 'Holds the cat name Dim lngTopicID 'Holds the topic number Dim lngMessageID 'Holds the message ID number Dim strSubject 'Holds the topic subject Dim strUsername 'Holds the Username of the thread Dim lngUserID 'Holds the ID number of the user Dim strAuthorSignature 'Holds the authors signature Dim dtmTopicDate 'Holds the date the thread was made Dim strMessage 'Holds the message body of the thread Dim blnForumLocked 'Set to true if the forum is locked Dim lngPollID 'Holds the poll ID Dim intCurrentRecord 'Holds the current records for the posts Dim strGuestUsername 'Holds the Guest Username if it is a guest posting Dim intTotalRecords 'Holds the total number of therads in this topic 'Initialise variables lngTopicID = 0 intForumID = 0 'Read in the Forum ID to display the Topics for If isNumeric(Request.QueryString("TID")) Then lngTopicID = CLng(Request.QueryString("TID")) Else lngTopicID = 0 'If there no Topic ID then redirect the user to the main forum page If lngTopicID = 0 Then 'Clean up Call closeDatabase() 'Redirect Response.Redirect("default.asp" & strQsSID1) End If 'Get the posts from the database strSQL = "" & _ "SELECT" & strDBTop1 & " " & strDbTable & "Category.Cat_name, " & strDbTable & "Forum.Forum_ID AS ForumID, " & strDbTable & "Forum.Forum_name, " & strDbTable & "Forum.Forum_description, " & strDbTable & "Forum.Password, " & strDbTable & "Forum.Forum_code, " & strDbTable & "Topic.Subject, " & strDbTable & "Permissions.View_Forum " & _ "FROM " & strDbTable & "Category" & strDBNoLock & ", " & strDbTable & "Forum" & strDBNoLock & ", " & strDbTable & "Forum AS " & strDbTable & "Forum2" & strDBNoLock & ", " & strDbTable & "Permissions" & strDBNoLock & ", " & strDbTable & "Topic" & strDBNoLock & " " & _ "WHERE " & strDbTable & "Category.Cat_ID=" & strDbTable & "Forum.Cat_ID " & _ "AND " & strDbTable & "Forum.Forum_ID=" & strDbTable & "Permissions.Forum_ID " & _ "AND " & strDbTable & "Forum.Forum_ID=" & strDbTable & "Topic.Forum_ID " & _ "AND " & strDbTable & "Topic.Topic_ID=" & lngTopicID & " " & _ "AND (" & strDbTable & "Permissions.Author_ID=" & lngLoggedInUserID & " OR " & strDbTable & "Permissions.Group_ID=" & intGroupID & ") " & _ "ORDER BY " & strDbTable & "Forum.Sub_ID, " & strDbTable & "Forum.Forum_Order, " & strDbTable & "Permissions.Author_ID DESC" & strDBLimit1 & ";" 'Query the database rsCommon.Open strSQL, adoCon 'If there is no record returended then set a message to say that If rsCommon.EOF Then 'If there are no thread's to display then display the appropriate error message strSubject = strTxtNoThreads 'Else get the details of the forum, permissions, and topic details Else 'Read in forum details from the database intForumID = Cint(rsCommon("ForumID")) strCatName = rsCommon("Cat_name") strForumName = rsCommon("Forum_name") strForumDescription = rsCommon("Forum_description") 'Read in the forum permissions blnRead = CBool(rsCommon("View_Forum")) 'Read in the topic details strSubject = rsCommon("Subject") 'Clean up input to prevent XXS hack strSubject = formatInput(strSubject) 'If the user has no read writes then kick them out If blnRead = False Then 'Reset Server Objects rsCommon.Close Call closeDatabase() 'Redirect to a page asking for the user to enter the forum password Response.Redirect("insufficient_permission.asp" & strQsSID1) End If '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 rsCommon("Password") <> "" AND (getCookie("fID", "Forum" & intForumID) <> rsCommon("Forum_code") AND getSessionItem("Forum" & intForumID) <> rsCommon("Forum_code")) Then 'Reset Server Objects rsCommon.Close Call closeDatabase() 'Redirect to a page asking for the user to enter the forum password Response.Redirect("forum_password_form.asp?RP=PT&FID=" & intForumID & "&TID=" & lngTopicID & strQsSID3) End If End If 'clean up rsCommon.Close 'Intilise SQL query to get all the posts 'Use a LEFT JOIN for the Guest name as there may not be a Guest name and so we want to include null values strSQL = "" & _ "SELECT " If strDatabaseType = "SQLServer" OR strDatabaseType = "Access" Then strSQL = strSQL & " TOP 100 " End If strSQL = strSQL & _ " " & strDbTable & "Thread.Thread_ID, " & strDbTable & "Thread.Message, " & strDbTable & "Thread.Message_date, " & strDbTable & "Thread.Show_signature, " & strDbTable & "Thread.IP_addr, " & strDbTable & "Thread.Hide, " & strDbTable & "Author.Author_ID, " & strDbTable & "Author.Username, " & strDbTable & "Author.Homepage, " & strDbTable & "Author.Location, " & strDbTable & "Author.No_of_posts, " & strDbTable & "Author.Join_date, " & strDbTable & "Author.Signature, " & strDbTable & "Author.Active, " & strDbTable & "Author.Avatar, " & strDbTable & "Author.Avatar_title, " & strDbTable & "Group.Name, " & strDbTable & "Group.Stars, " & strDbTable & "Group.Custom_stars, " & strDbTable & "GuestName.Name " & _ "FROM (" & strDbTable & "Group INNER JOIN (" & strDbTable & "Author INNER JOIN " & strDbTable & "Thread ON " & strDbTable & "Author.Author_ID = " & strDbTable & "Thread.Author_ID) ON " & strDbTable & "Group.Group_ID = " & strDbTable & "Author.Group_ID) LEFT JOIN " & strDbTable & "GuestName ON " & strDbTable & "Thread.Thread_ID = " & strDbTable & "GuestName.Thread_ID " & _ "WHERE " & strDbTable & "Thread.Topic_ID=" & lngTopicID & " " & _ "AND " & strDbTable & "Thread.Hide=" & strDBFalse & " " & _ "ORDER BY " & strDbTable & "Thread.Message_date ASC" 'mySQL limit operator If strDatabaseType = "mySQL" Then strSQL = strSQL & " LIMIT 100" End If strSQL = strSQL & ";" 'Query the database rsCommon.Open strSQL, adoCon 'If there is a topic in the database then get the post data If NOT rsCommon.EOF Then 'Read in the topivc recordset into an array sarryPosts = rsCommon.GetRows() 'SQL Query Array Look Up table '0 = tblThread.Thread_ID, '1 = tblThread.Message, '2 = tblThread.Message_date, '3 = tblThread.Show_signature, '4 = tblThread.IP_addr, '5 = tblThread.Hide, '6 = tblAuthor.Author_ID, '7 = tblAuthor.Username, '8 = tblAuthor.Homepage, '9 = tblAuthor.Location, '10 = tblAuthor.No_of_posts, '11 = tblAuthor.Join_date, '12 = tblAuthor.Signature, '13 = tblAuthor.Active, '14 = tblAuthor.Avatar, '15 = tblAuthor.Avatar_title, '16 = tblGroup.Name, '17 = tblGroup.Stars, '18 = tblGroup.Custom_stars '19 = tblGuestName.Name 'Count the number of records intTotalRecords = Ubound(sarryPosts,2) + 1 End If 'Clean up rsCommon.Close Call closeDatabase() 'If active users is enabled update the active users application array If blnActiveUsers Then 'Call active users function saryActiveUsers = activeUsers(strTxtViewingTopic, strSubject, "forum_posts.asp?TID=" & lngTopicID, intForumID) End If %>
| <% = strTxtPrintPage %> | <% = strTxtCloseWindow %> |
| <% 'If there are no threads returned by the qury then display an error message If intTotalRecords = 0 Then %>
------------- " & strAuthorSignature End If %> <% = strSubject %> <% = strTxtPrintedFrom %>: <% = strWebsiteName %> <% = strTxtCategory %>: <% = strCatName %> <% = strTxtForumName %>: <% = strForumName %> <% = strTxtForumDiscription %>: <% = strForumDescription %> <% = strTxtURL %>: <% = strForumPath %>forum_posts.asp?TID=<% = lngTopicID %> <% = strTxtPrintedDate %>: <% = stdDateFormat(Now(), True) & " " & strTxtAt & " " & TimeFormat(Now()) %> <% If blnLCode = True Then %> <% = strTxtSoftwareVersion %>: Web Wiz Forums <% = strVersion %> - http://www.webwizforums.com<% End If %> <% = strTxtTopic %>: <% = strSubject %> <% = strTxtPostedBy %>: <% = strUsername %> <% = strTxtSubjectFolder %>: <% = strSubject %> <% = strTxtDatePosted %>: <% = stdDateFormat(dtmTopicDate, True) %> <% = strTxtAt %> <% = TimeFormat(dtmTopicDate) %>
<% 'If there are replies then display that there are If intTotalRecords > 1 Then Response.Write " " & strTxtReplies & ": " 'Move to the next record intCurrentRecord = intCurrentRecord + 1 %> <% 'Do....While Loop to loop through the recorset to display the topic posts Do While intCurrentRecord < intTotalRecords 'If there are no post records left to display then exit loop If intCurrentRecord >= intTotalRecords Then Exit Do 'Read in threads details for the topic from the database lngMessageID = CLng(sarryPosts(0,intCurrentRecord)) strMessage = sarryPosts(1,intCurrentRecord) dtmTopicDate = CDate(sarryPosts(2,intCurrentRecord)) lngUserID = CLng(sarryPosts(6,intCurrentRecord)) strUsername = sarryPosts(7,intCurrentRecord) strAuthorSignature = sarryPosts(12,intCurrentRecord) strGuestUsername = sarryPosts(19,intCurrentRecord) 'If the message has been edited remove who edited the post If InStr(1, strMessage, " ------------- " & strAuthorSignature End If %> <% = strTxtPostedBy %>: <% = strUsername %> <% = strTxtDatePosted %>: <% = stdDateFormat(dtmTopicDate, True) %> <% = strTxtAt %> <% = TimeFormat(dtmTopicDate) %>
<% 'Move to the next record intCurrentRecord = intCurrentRecord + 1 Loop %> |
| <% = strTxtPrintPage %> | <% = strTxtCloseWindow %>
<% '***** START WARNING - REMOVAL OR MODIFICATION OF THIS CODE WILL VIOLATE THE LICENSE AGREEMENT ****** If blnLCode = True Then Response.Write("Bulletin Board Software by Web Wiz Forums® version " & strVersion& " - http://www.webwizforums.com") Response.Write(" Copyright ©2001-2008 Web Wiz - http://www.webwizguide.com") End If '***** END WARNING - REMOVAL OR MODIFICATION OF THIS CODE WILL VIOLATE THE LICENSE AGREEMENT ****** %> |