⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 active_topics.asp

📁 简单的asp论坛源码系统,很适用于初学者!界面简洁,功能齐全
💻 ASP
📖 第 1 页 / 共 3 页
字号:
End If
strSQL = strSQL & _
" " & strDbTable & "Forum.Forum_ID, " & strDbTable & "Forum.Forum_name, " & strDbTable & "Forum.Password, " & strDbTable & "Forum.Forum_code, " & strDbTable & "Topic.Topic_ID, " & strDbTable & "Topic.Poll_ID, " & strDbTable & "Topic.Moved_ID, " & strDbTable & "Topic.Subject, " & strDbTable & "Topic.Icon, " & strDbTable & "Topic.Start_Thread_ID, " & strDbTable & "Topic.Last_Thread_ID, " & strDbTable & "Topic.No_of_replies, " & strDbTable & "Topic.No_of_views, " & strDbTable & "Topic.Locked, " & strDbTable & "Topic.Priority, " & strDbTable & "Topic.Hide, " & strDbTable & "Thread.Message_date, " & strDbTable & "Thread.Message, " & strDbTable & "Thread.Author_ID, " & strDbTable & "Author.Username, LastThread.Message_date, LastThread.Author_ID, LastAuthor.Username, " & strDbTable & "Topic.Event_date, " & strDbTable & "Topic.Event_date_end " & _
"FROM " & strDbTable & "Category" & strDBNoLock & ", " & strDbTable & "Forum" & strDBNoLock & ", " & strDbTable & "Topic" & strDBNoLock & ", " & strDbTable & "Thread" & strDBNoLock & ", " & strDbTable & "Thread AS LastThread" & strDBNoLock & ", " & strDbTable & "Author" & strDBNoLock & ", " & strDbTable & "Author AS LastAuthor" & strDBNoLock & " " & _
"WHERE " & strDbTable & "Category.Cat_ID = " & strDbTable & "Forum.Cat_ID " & _
	"AND " & strDbTable & "Forum.Forum_ID = " & strDbTable & "Topic.Forum_ID " & _
	"AND " & strDbTable & "Thread.Author_ID = " & strDbTable & "Author.Author_ID " & _
	"AND LastThread.Author_ID = LastAuthor.Author_ID " & _
	"AND " & strDbTable & "Topic.Start_Thread_ID = " & strDbTable & "Thread.Thread_ID " & _
	"AND " & strDbTable & "Topic.Last_Thread_ID = LastThread.Thread_ID "

'This will remove most of the entires	
strSQL = strSQL & "AND (LastThread.Message_date > " & dtmActiveFrom & ")"

strSQL = strSQL & _
	"AND (" & strDbTable & "Topic.Forum_ID " & _
		"IN (" & _
			"SELECT " & strDbTable & "Permissions.Forum_ID " & _
			"FROM " & strDbTable & "Permissions " & strDBNoLock & " " & _
			"WHERE (" & strDbTable & "Permissions.Group_ID = " & intGroupID & " OR " & strDbTable & "Permissions.Author_ID = " & lngLoggedInUserID & ") " & _
				"AND " & strDbTable & "Permissions.View_Forum = " & strDBTrue & _
		")" & _
	")"


'If this isn't a moderator only display hidden posts if the user posted them
If blnModerator = false AND blnAdmin = false Then
	strSQL = strSQL & "AND (" & strDbTable & "Topic.Hide = " & strDBFalse & " "
	'Don't display hidden posts if guest
	If intGroupID <> 2 Then strSQL = strSQL & "OR " & strDbTable & "Thread.Author_ID = " & lngLoggedInUserID
	strSQL = strSQL & ") "
End If

'If we want unaswered posts only display them
If blnUnAnsweredPosts Then strSQL = strSQL & "AND (" & strDbTable & "Topic.No_of_replies = 0)"

'Order by cluase
strSQL = strSQL & "ORDER BY " & strDbTable & "Category.Cat_order ASC, " & strDbTable & "Forum.Forum_Order ASC, " & strSortBy & " "

'mySQL limit operator
If strDatabaseType = "mySQL" Then
	strSQL = strSQL & " LIMIT " & intMaxResults
End If
strSQL = strSQL & ";"


'Set error trapping
On Error Resume Next
	
'Query the database
rsCommon.Open strSQL, adoCon


'If an error has occurred write an error to the page
If Err.Number <> 0 AND  strDatabaseType = "mySQL" Then	
	Call errorMsg("An error has occurred while executing SQL query on database.<br />Please check that the MySQL Server version is 4.1 or above.", "get_active_topics", "active_topics.asp")
ElseIf Err.Number <> 0 Then	
	Call errorMsg("An error has occurred while executing SQL query on database.", "get_active_topics", "active_topics.asp")
End If
			
'Disable error trapping
On Error goto 0


'SQL Query Array Look Up table
'0 = tblForum.Forum_ID
'1 = tblForum.Forum_name
'2 = tblForum.Password
'3 = tblForum.Forum_code
'4 = tblTopic.Topic_ID
'5 = tblTopic.Poll_ID
'6 = tblTopic.Moved_ID
'7 = tblTopic.Subject
'8 = tblTopic.Icon
'9 = tblTopic.Start_Thread_ID
'10 = tblTopic.Last_Thread_ID
'11 = tblTopic.No_of_replies
'12 = tblTopic.No_of_views
'13 = tblTopic.Locked
'14 = tblTopic.Priority
'15 = tblTopic.Hide
'16 = tblThread.Message_date
'17 = tblThread.Message, 
'18 = tblThread.Author_ID, 
'19 = tblAuthor.Username, 
'20 = LastThread.Message_date, 
'21 = LastThread.Author_ID, 
'22 = LastAuthor.Username
'23 = tblTopic.Event_date
'24 = tblTopic.Event_date_end
	

'Read in some details of the topics
If NOT rsCommon.EOF Then 
	
	'Read in the topic recordset into an array
	sarryTopics = rsCommon.GetRows()
	
	'Count the number of records
	intTotalRecords = Ubound(sarryTopics,2) + 1

	'Count the number of pages for the topics using '\' so that any fraction is omitted 
	intTotalRecordsPages = intTotalRecords \ intTopicPerPage
	
	'If there is a remainder or the result is 0 then add 1 to the total num of pages
	If intTotalRecords Mod intTopicPerPage > 0 OR intTotalRecordsPages = 0 Then intTotalRecordsPages = intTotalRecordsPages + 1
		
	'Start position
	intStartPosition = ((intRecordPositionPageNum - 1) * intTopicPerPage)

	'End Position
	intEndPosition = intStartPosition + intTopicPerPage
		
	'Get the start position
	intCurrentRecord = intStartPosition
End If

'Close the recordset
rsCommon.Close




'Set the page name and link (this page acts as two pages (active topics and unanswered topics)
If blnUnAnsweredPosts Then 
	strPageName = strTxtUnAnsweredTopics 'Page Name
	strPageURL = "active_topics.asp?UA=Y&" 'This is done so we know what page we are on
	strLinkPage = "active_topics.asp?UA=Y&" 'This is done for the mutiple page links as it can chnage the querystring
	'Set bread crumb trail
	strBreadCrumbTrail = strBreadCrumbTrail & strNavSpacer & "<a href=""active_topics.asp?UA=Y" & strQsSID2 & """>" & strTxtUnAnsweredTopics & "</a>"
	strStatusBarTools = strStatusBarTools & "&nbsp;&nbsp;<img src=""" & strImagePath & "active_topics." & strForumImageType & """ alt=""" & strTxtActiveTopics & """ title=""" & strTxtActiveTopics & """ style=""vertical-align: text-bottom"" /> <a href=""active_topics.asp" & strQsSID1 & """>" & strTxtActiveTopics & "</a> "
Else 
	strPageName = strTxtActiveTopics
	strPageURL = "active_topics.asp?"
	strLinkPage = "active_topics.asp?"
	'Set bread crumb trail
	strBreadCrumbTrail = strBreadCrumbTrail & strNavSpacer & "<a href=""active_topics.asp" & strQsSID1 & """>" & strTxtActiveTopics & "</a>"
	strStatusBarTools = strStatusBarTools & "&nbsp;&nbsp;<img src=""" & strImagePath & "unanswered_topics." & strForumImageType & """ alt=""" & strTxtUnAnsweredTopics & """ title=""" & strTxtUnAnsweredTopics & """ style=""vertical-align: text-bottom"" /> <a href=""active_topics.asp?UA=Y" & strQsSID2 & """>" & strTxtUnAnsweredTopics & "</a> "
End If



'If RSS XML enabled then display an RSS button to link to XML file
If blnRSS Then strStatusBarTools = strStatusBarTools & "&nbsp;<a href=""RSS_topic_feed.asp" & strQsSID1 & """ target=""_blank""><img src=""" & strImagePath & "rss." & strForumImageType & """ title=""" & strTxtRSS & ": " & strTxtNewPostFeed & """ /></a>"



'If active users is enabled update the active users application array
If blnActiveUsers Then
	'Call active users function
	saryActiveUsers = activeUsers("", strTxtViewing & " " & strPageName, strPageURL, 0)
End If



%>
<!-- #include file="includes/browser_page_encoding_inc.asp" -->
<meta name="generator" content="Web Wiz Forums" />
<title><% = strMainForumName & ": " & strPageName %></title>

<%
'***** START WARNING - REMOVAL OR MODIFICATION OF THIS CODE WILL VIOLATE THE LICENSE AGREEMENT ******
Response.Write("<!--//" & _
vbCrLf & "/* *******************************************************" & _
vbCrLf & "Software: Web Wiz Forums(TM) ver. " & strVersion & "" & _
vbCrLf & "Info: http://www.webwizforums.com" & _
vbCrLf & "Copyright: (C)2001-2008 Web Wiz(TM). All rights reserved" & _
vbCrLf & "******************************************************* */" & _
vbCrLf & "//-->")
'***** END WARNING - REMOVAL OR MODIFICATION OF THIS CODE WILL VIOLATE THE LICENSE AGREEMENT ******


'If RSS Feed is enabled then have an alt link to the XML file for supporting browsers
If blnRSS Then Response.Write(vbCrLf & "<link rel=""alternate"" type=""application/rss+xml"" title=""RSS 2.0"" href=""RSS_topic_feed.asp" & strQsSID2 & """>")
%>

<script  language="JavaScript">
//Function to choose how many topics are show
function ShowTopics(Show){

   	strShow = escape(Show.options[Show.selectedIndex].value);

   	if (Show != '') self.location.href = '<% = strPageURL %>AT=' + strShow + '&PN=1<% = strQsSID2 %>';
	return true;
}
</script>
<link href="<% = strCSSfile %>default_style.css" rel="stylesheet" type="text/css" />
<!-- #include file="includes/header.asp" -->
<!-- #include file="includes/status_bar_header_inc.asp" -->
<table class="basicTable" cellspacing="0" cellpadding="3" align="center">
 <tr>
  <td><h1><% = strPageName %></h1></td>
</tr>
</table>
<table class="basicTable" cellspacing="0" cellpadding="4" align="center">
 <tr>
  <td><% = strTxtShowTopics %>
   <select name="show" id="show" onchange="ShowTopics(this)">
    <option value="1" <% If intShowTopicsFrom = 1 Then Response.Write "selected" %>><% = DateFormat(dtmLastVisitDate) & " " & strTxtAt & " " & TimeFormat(dtmLastVisitDate) %></option>
    <option value="2" <% If intShowTopicsFrom = 2 Then Response.Write "selected" %>><% = strTxtLastFifteenMinutes %></option>
    <option value="3" <% If intShowTopicsFrom = 3 Then Response.Write "selected" %>><% = strTxtLastThirtyMinutes %></option>
    <option value="4" <% If intShowTopicsFrom = 4 Then Response.Write "selected" %>><% = strTxtLastFortyFiveMinutes %></option>
    <option value="5" <% If intShowTopicsFrom = 5 Then Response.Write "selected" %>><% = strTxtLastHour %></option>
    <option value="6" <% If intShowTopicsFrom = 6 Then Response.Write "selected" %>><% = strTxtLastTwoHours %></option>
    <option value="7" <% If intShowTopicsFrom = 7 Then Response.Write "selected" %>><% = strTxtLastFourHours %></option>
    <option value="8" <% If intShowTopicsFrom = 8 Then Response.Write "selected" %>><% = strTxtLastSixHours %></option>
    <option value="9" <% If intShowTopicsFrom = 9 Then Response.Write "selected" %>><% = strTxtLastEightHours %></option>
    <option value="10" <% If intShowTopicsFrom = 10 Then Response.Write "selected" %>><% = strTxtLastTwelveHours %></option>
    <option value="11" <% If intShowTopicsFrom = 11 Then Response.Write "selected" %>><% = strTxtLastSixteenHours %></option>
    <option value="12" <% If intShowTopicsFrom = 12 Then Response.Write "selected" %>><% = strTxtYesterday %></option>
    <option value="13" <% If intShowTopicsFrom = 13 Then Response.Write "selected" %>><% = strTxtLastTwoDays %></option>
    <option value="14" <% If intShowTopicsFrom = 14 Then Response.Write "selected" %>><% = strTxtLastWeek %></option>
    <option value="15" <% If intShowTopicsFrom = 15 Then Response.Write "selected" %>><% = strTxtLastMonth %></option>
    <option value="16" <% If intShowTopicsFrom = 16 Then Response.Write "selected" %>><% = strTxtLastTwoMonths %></option>
    <option value="17" <% If intShowTopicsFrom = 17 Then Response.Write "selected" %>><% = strTxtLastSixMonths %></option>
    <option value="18" <% If intShowTopicsFrom = 18 Then Response.Write "selected" %>><% = strTxtLastYear %></option>
   </select>
  </td>
   <td align="right" nowrap><!-- #include file="includes/page_link_inc.asp" --></td>
 </tr>
</table>
<table cellspacing="1" cellpadding="3" class="tableBorder" align="center">
 <tr class="tableLedger">
  <td width="5%">&nbsp;</td>
  <td width="50%"><a href="<% = strPageURL %>SO=T<% = strQsSID2 %>" title="<% =  strTxtReverseSortOrder %>"><% = strTxtTopics %></a><% If Request.QueryString("SO") = "T" Then Response.Write(" <a href=""" & strPageURL & "SO=T&OB=" & strSortDirection & strQsSID2 & """><img src=""" & strImagePath & strSortDirection & "." & strForumImageType & """ title=""" & strTxtReverseSortOrder & """ alt=""" & strTxtReverseSortOrder & """ /></a>") %> / <a href="<% = strPageURL %>SO=A<% = strQsSID2 %>"><% = strTxtThreadStarter %></a><% If Request.QueryString("SO") = "A" Then Response.Write(" <a href=""" & strPageURL & "SO=A&OB=" & strSortDirection & strQsSID2 & """ title=""" & strTxtReverseSortOrder & """><img src=""" & strImagePath & strSortDirection & "." & strForumImageType & """ title=""" & strTxtReverseSortOrder & """ alt=""" & strTxtReverseSortOrder & """ /></a>") %></td>
  <td width="10%" align="center" nowrap><a href="<% = strPageURL %>SO=R<% = strQsSID2 %>" title="<% =  strTxtReverseSortOrder %>"><% = strTxtReplies %></a><% If Request.QueryString("SO") = "R" Then Response.Write(" <a href=""" & strPageURL & "SO=R&OB=" & strSortDirection & strQsSID2 & """><img src=""" & strImagePath & strSortDirection & "." & strForumImageType & """ title=""" & strTxtReverseSortOrder & """ alt=""" & strTxtReverseSortOrder & """ /></a>") %></td>
  <td width="10%" align="center" nowrap><a href="<% = strPageURL %>SO=V<% = strQsSID2 %>" title="<% =  strTxtReverseSortOrder %>"><% = strTxtViews %></a><% If Request.QueryString("SO") = "V" Then Response.Write(" <a href=""" & strPageURL & "SO=V&OB=" & strSortDirection & strQsSID2 & """><img src=""" & strImagePath & strSortDirection & "." & strForumImageType & """ title=""" & strTxtReverseSortOrder & """ alt=""" & strTxtReverseSortOrder & """ /></a>") %></td>
  <td width="30%"><a href="<% = strPageURL %><% = strQsSID2 %>" title="<% =  strTxtReverseSortOrder %>"><% = strTxtLastPost %></a><% If Request.QueryString("SO") = "" Then Response.Write(" <a href=""" & strPageURL & "OB=" & strSortDirection & strQsSID2 & """><img src=""" & strImagePath & strSortDirection & "." & strForumImageType & """ title=""" & strTxtReverseSortOrder & """ alt=""" & strTxtReverseSortOrder & """ /></a>") %></td>
 </tr><%




'If there are no active topics display an error msg
If intTotalRecords <= 0 Then
	
	'If there are no Active Topic's to display then display the appropriate error message
	Response.Write(vbCrLf & " <tr class=""tableRow""><td colspan=""6"" align=""center""><br />" & strTxtNoActiveTopicsSince & " " & strShowTopicsFrom & " " & strTxtToDisplay & "<br /><br /></td></tr>")




'Disply any active topics in the forum
Else


	'Do....While Loop to loop through the recorset to display the forum topics
	Do While intCurrentRecord < intEndPosition

		'If there are no topic records left to display then exit loop
		If intCurrentRecord >= intTotalRecords Then Exit Do
			
			
		'SQL Query Array Look Up table
		'0 = tblForum.Forum_ID
		'1 = tblForum.Forum_name
		'2 = tblForum.Password
		'3 = tblForum.Forum_code
		'4 = tblTopic.Topic_ID
		'5 = tblTopic.Poll_ID
		'6 = tblTopic.Moved_ID
		'7 = tblTopic.Subject
		'8 = tblTopic.Icon
		'9 = tblTopic.Start_Thread_ID
		'10 = tblTopic.Last_Thread_ID
		'11 = tblTopic.No_of_replies
		'12 = tblTopic.No_of_views
		'13 = tblTopic.Locked
		'14 = tblTopic.Priority
		'15 = tblTopic.Hide
		'16 = tblThread.Message_date
		'17 = tblThread.Message, 
		'18 = tblThread.Author_ID, 
		'19 = tblAuthor.Username, 
		'20 = LastThread.Message_date, 
		'21 = LastThread.Author_ID, 
		'22 = LastAuthor.Username

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -