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

📄 default.asp

📁 简单的asp论坛源码系统,很适用于初学者!界面简洁,功能齐全
💻 ASP
📖 第 1 页 / 共 3 页
字号:




'We have tgo use a seporate query to count the number of members in mySQL
If strDatabaseType = "mySQL" Then

	'Count the number of members
	strSQL = "SELECT Count(" & strDbTable & "Author.Author_ID) AS memberCount " & _
	"FROM " & strDbTable & "Author;"
	
	'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 Then	Call errorMsg("An error has occurred while executing SQL query on database.", "member_count", "default.asp")
				
	'Disable error trapping
	On Error goto 0
	
	'Read in member count from database
	lngNoOfMembers = CLng(rsCommon("memberCount"))
	
	'Close recordset
	rsCommon.close
End If






'If active users is enabled update the active users application array
If blnActiveUsers Then
	'Call active users function
	saryActiveUsers = activeUsers("", strTxtForumIndex, "default.asp", 0)
End If

'Set the status bar tools
'Active Topics Links
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> "
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> "
'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 & """ alt=""" & strTxtRSS & ": " & strTxtNewPostFeed & """ title=""" & strTxtRSS & ": " & strTxtNewPostFeed & """ /></a>"

%>
<!-- #include file="includes/browser_page_encoding_inc.asp" -->
<title><% = strMainForumName %><% If blnLCode Then Response.Write(" - Powered by Web Wiz Forums&trade;") %></title>
<meta name="generator" content="Web Wiz Forums" /><%

'***** START WARNING - REMOVAL OR MODIFICATION OF THIS CODE WILL VIOLATE THE LICENSE AGREEMENT ******
If blnLCode Then	
 	Response.Write(vbCrLf & "<meta name=""description"" content=""This is a discussion forum powered by Web Wiz Forums. To find out about Web Wiz Forums, go to http://www.webwizforums.com"" />" & _
 	vbCrLf & "<meta name=""keywords"" content=""forum, bbs, discussion, bulletin board, message board"" />")
End If

Response.Write(vbCrLf  & vbCrLf & "<!--//" & _
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 & "//-->" & 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" & strQsSID1 & """ />")

%>
<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="1" cellpadding="3" align="center">
 <tr>
  <td class="smText"><% = strTxtTheTimeNowIs & " " & TimeFormat(now()) %><br /><%

'If this is not the first time the user has visted the site display the last visit time and date
If IsDate(getCookie("lVisit", "LV")) Then
	If dtmLastVisitDate < CDate(getCookie("lVisit", "LV")) Then
	   	Response.Write(strTxtYouLastVisitedOn & " " & DateFormat(dtmLastVisitDate) & " " & strTxtAt & " " & TimeFormat(dtmLastVisitDate))
	End If
End If

%><br /></td><%

'If the user has not logged in (guest user ID = 2) then show them a quick login form
If lngLoggedInUserID = 2 AND blnWindowsAuthentication = False AND (blnMemberAPI = False OR blnMemberAPIDisableAccountControl = False) Then
	
	Response.Write(" <td align=""right"" class=""smText"">"  & _
	vbCrLf & "  <form method=""post"" name=""frmLogin"" id=""frmLogin"" action=""login_user.asp" & strQsSID1 & """>" & strTxtQuickLogin & _
	vbCrLf & "   <input type=""text"" size=""10"" name=""name"" id=""name"" style=""font-size: 10px;"" tabindex=""1"" />" & _
	vbCrLf & "   <input type=""password"" size=""10"" name=""password"" id=""password"" style=""font-size: 10px;"" tabindex=""2"" />" & _
	vbCrLf & "   <input type=""hidden"" name=""NS"" id=""NS"" value=""1"" />" & _
	vbCrLf & "   <input type=""hidden"" name=""returnURL"" id=""returnURL"" value=""returnURL=default.asp"" />" & _
	vbCrLf & "   <input type=""submit"" value=""" & strTxtGo & """ style=""font-size: 10px;"" tabindex=""3"" />" & _
	vbCrLf & "  </form>" & _
	vbCrLf & " </td>")	
	
End If

Response.Write(vbCrLf & " </tr>")


 %>
</table>
<br /><%



'Check there are categories to display
If intTotalRecords = 0 Then
	
%>
<table cellspacing="1" cellpadding="3" class="tableBorder" align="center">
 <tr class="tableLedger">
  <td width="5%">&nbsp;</td>
  <td width="50%"><% = strTxtForum %></td>
  <td width="10%" align="center"><% = strTxtTopics %></td>
  <td width="10%" align="center"><% = strTxtPosts %></td>
  <td width="30%" align="center"><% = strTxtLastPost %></td>
 </tr>
 <tr>
  <td colspan="5" class="tableRow"><% = strTxtNoForums %></td></tr>
 </tr>
</table>
<br /><%


'Else there the are categories so write the HTML to display categories and the forum names and a discription
Else	

	'Loop round to show all the categories and forums
	Do While intCurrentRecord <= Ubound(sarryForums,2)
	
		
		'Loop through the array looking for forums that are to be shown
		'if a forum is found to be displayed then show the category and the forum, if not the category is not displayed as there are no forums the user can access
		Do While intCurrentRecord <= Ubound(sarryForums,2)
		
			'Read in details
			blnHideForum = CBool(sarryForums(13,intCurrentRecord))
			blnRead = CBool(sarryForums(14,intCurrentRecord))
					
			'If this forum is to be shown then leave the loop and display the cat and the forums
			If blnHideForum = False OR blnRead Then Exit Do
			
			'Move to next record
			intCurrentRecord = intCurrentRecord + 1
		Loop
				
		'If we have run out of records jump out of loop
		If intCurrentRecord > Ubound(sarryForums,2) Then Exit Do
	
	
		'Read in the details from the array of this category
		intCatID = CInt(sarryForums(0,intCurrentRecord))
		strCategory = sarryForums(1,intCurrentRecord)		
		

%>
<table cellspacing="1" cellpadding="3" class="tableBorder" align="center">
 <tr class="tableLedger">
  <td width="5%">&nbsp;</td>
  <td width="50%"><% = strTxtForum %></td>
  <td width="10%" align="center"><% = strTxtTopics %></td>
  <td width="10%" align="center"><% = strTxtPosts %></td>
  <td width="30%"><% = strTxtLastPost %></td>
 </tr><%
		
		'Display the category name
		Response.Write vbCrLf & " <tr class=""tableSubLedger""><td colspan=""5""><a href=""default.asp?C=" & intCatID & strQsSID2 & """>" & strCategory & "</a></td></tr>"
		
		'If the user only wants to see one category, only display the forums for that category
		If intCatShow = intCatID OR intCatShow = 0 Then
			
			'Loop round to display all the forums for this category
			Do While intCurrentRecord <= Ubound(sarryForums,2)
				
				'Initialise variables
				strSubForums = ""
			
			
				'Read in the details for this forum
				intForumID = CInt(sarryForums(2, intCurrentRecord))
				intSubForumID = CInt(sarryForums(3, intCurrentRecord))
				strForumName = sarryForums(4, intCurrentRecord)
				strForumDiscription = sarryForums(5, intCurrentRecord)
				lngNumberOfTopics = CLng(sarryForums(6, intCurrentRecord))
				lngNumberOfPosts = CLng(sarryForums(7, intCurrentRecord))
				strLastEntryUser = sarryForums(8, intCurrentRecord)
				If isNumeric(sarryForums(9, intCurrentRecord)) Then lngLastEntryUserID = CLng(sarryForums(9, intCurrentRecord)) Else lngLastEntryUserID = 0
				If isDate(sarryForums(10, intCurrentRecord)) Then dtmLastEntryDate = CDate(sarryForums(10, intCurrentRecord)) Else dtmLastEntryDate = CDate("2001-01-01 00:00:00")
				If isNull(sarryForums(11, intCurrentRecord)) Then strForumPassword = "" Else strForumPassword = sarryForums(11, intCurrentRecord)
				blnForumLocked = CBool(sarryForums(12, intCurrentRecord))
				blnHideForum = CBool(sarryForums(13, intCurrentRecord))
				blnRead = CBool(sarryForums(14, intCurrentRecord))
				If isNumeric(sarryForums(15, intCurrentRecord)) Then lngTopicID = CLng(sarryForums(15, intCurrentRecord)) Else lngTopicID = 0
				strSubject = sarryForums(16, intCurrentRecord)	
				
				'Set the last forum ID for forum stats
				intLastForumEntryID = intForumID

				'If this forum is to be hidden but the user is allowed access to it set the hidden boolen back to false
				If blnHideForum AND blnRead Then blnHideForum = False

				'Calculate the number of people viewing the forum
				If blnForumViewing AND blnActiveUsers Then 
					intTotalViewingForum = viewingForum(intForumID)
				End If
				
				'If the forum is not a hidden forum to this user, display it
				If blnHideForum = False AND intSubForumID = 0 Then

					
					'Stats ***********
					'Count the number of forums
					intNumberofForums = intNumberofForums + 1
	
					'Add all the posts and topics together to get the total number for the stats at the bottom of the page
					lngTotalNumberOfPosts = lngTotalNumberOfPosts + lngNumberOfPosts
					lngTotalNumberOfTopics = lngTotalNumberOfTopics + lngNumberOfTopics
					
					'Calculate the last forum entry across all forums for the statistics at the bottom of the forum
					If dtmLastEntryDateAllForums < dtmLastEntryDate Then
						strLastEntryUserAllForums = strLastEntryUser
						lngLastEntryUserIDAllForums = lngLastEntryUserID
						dtmLastEntryDateAllForums = dtmLastEntryDate
					End If
					
					
					
					
					'Unread Posts *********
					intUnReadPostCount = 0
					
					'If there is a newer post than the last time the unread posts array was initilised run it again
					If dtmLastEntryDate > CDate(Session("dtmUnReadPostCheck")) Then Call UnreadPosts()
						
					'Count the number of unread posts in this forum
					If isArray(sarryUnReadPosts) AND dtmLastEntryDate > dtmLastVisitDate AND blnRead Then
						For intUnReadForumPostsLoop = 0 to UBound(sarryUnReadPosts,2)
							'Increament unread post count
							If CInt(sarryUnReadPosts(2,intUnReadForumPostsLoop)) = intForumID AND sarryUnReadPosts(3,intUnReadForumPostsLoop) = "1" Then intUnReadPostCount = intUnReadPostCount + 1
						Next
					End If
					
					
					
					
					'Get the row number
					intForumColourNumber = intForumColourNumber + 1


					
					'Display if this forum has any subforums
					'***************************************
					
					'Initilise variables
					intTempRecord = 0
					
					'Loop round to read in any sub forums in the stored array recordset
					Do While intTempRecord <= Ubound(sarryForums,2) 
					
					
						'Becuase the member may have an individual permission entry in the permissions table for this forum, 
						'it maybe listed twice in the array, so we need to make sure we don't display the same forum twice
						If intSubForumID = CInt(sarryForums(2,intTempRecord)) Then intTempRecord = intTempRecord + 1
							
						'If there are no records left exit loop
						If intTempRecord > Ubound(sarryForums,2) Then Exit Do
				
						'If this is a subforum of the main forum then get the details
						If CInt(sarryForums(3,intTempRecord)) = intForumID Then
													
						
							'Read in sub forum details from the database
							intSubForumID = CInt(sarryForums(2,intTempRecord))
							strSubForumName = sarryForums(4,intTempRecord)
							lngSubForumNumberOfTopics = CLng(sarryForums(6,intTempRecord))
							lngSubForumNumberOfPosts = CLng(sarryForums(7,intTempRecord))
							strLastSubEntryUser = sarryForums(8,intTempRecord)
							If isNumeric(sarryForums(9,intTempRecord)) Then lngLastSubEntryUserID = CLng(sarryForums(9,intTempRecord)) Else lngLastEntryUserID = 0
							If isDate(sarryForums(10,intTempRecord)) Then dtmLastSubEntryDate = CDate(sarryForums(10,intTempRecord)) Else dtmLastSubEntryDate = CDate("2001-01-01 00:00:00")
							If isNull(sarryForums(11, intCurrentRecord)) Then strSubForumPassword = "" Else strSubForumPassword = sarryForums(11, intCurrentRecord)
							blnHideForum = CBool(sarryForums(13,intTempRecord))	
							blnSubRead = CBool(sarryForums(14,intTempRecord))
							If isNumeric(sarryForums(15, intTempRecord)) Then lngSubTopicID = CLng(sarryForums(15, intTempRecord)) Else lngSubTopicID = 0
							
							strSubSubject = sarryForums(16, intTempRecord)	
						
				
							'If this sub forum is to be hidden and but the user is allowed access to it set the hidden boolen back to false
							If blnHideForum = True AND blnSubRead = True Then blnHideForum = False
						
							'If the sub forum is to be hidden then don't show it
							If blnHideForum = False Then
								
								'Stats **********
								'Count the number of forums
								intNumberofForums = intNumberofForums + 1

⌨️ 快捷键说明

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