create_articleindexcls.asp

来自「多用户管理分权限发布、管理软件信息;  自由选择系统默认为静态HTML或动态A」· ASP 代码 · 共 435 行 · 第 1/2 页

ASP
435
字号
			Do While Not Rs.EOF
				If Rs("Postime") >= Date Then
					PostTime = "<FONT color=red>" & FormatDateTime(Rs("Postime"), 2) & "</FONT >"
				Else
					PostTime = "<FONT color=#999999>" & FormatDateTime(Rs("Postime"), 2) & "</FONT >"
				End If
				MsgTitle = "<A HREF=""javascript:openScript('" & Newasp.SetupDir & "message.asp?id=" & Rs("id") & "',500,400)"" title='" & Rs("title") & "'>" & Newasp.gotTopic(Rs("title"), CInt(Newasp.TempSet(1))) & "</A>"
				HtmlString = HtmlString & Newasp.TempSet(2)
				HtmlString = Replace(HtmlString, "{$MsgTitle}", MsgTitle)
				HtmlString = Replace(HtmlString, "{$PostTime}", PostTime)
				Rs.movenext
			Loop
		End If
		Rs.Close
		Set Rs = Nothing
		WebMessage = HtmlString
	End Function
	'*************************************************************
	'函数作用:统计信息
	'*************************************************************
	Private Function Statistics()
		Dim Rs, SQL, HtmlString
		Dim AllSoft, DayUpdateSoft, AllDownNum, AllSoftSize
		Dim AllArticle, DayUpdateArt, AllArticleHits, AllUserNum
		Set Rs = Server.CreateObject("adodb.recordset")
		SQL = "Select count(SoftID) from NC_SoftInfo"
		Rs.Open SQL, Conn, 1, 1
		AllSoft = Rs(0)
		If IsNull(AllSoft) Then AllSoft = 0
		Rs.Close

		If isSqlDataBase = 1 Then
			SQL = "Select count(SoftID) from NC_SoftInfo Where datediff(d,SoftTime,GetDate())=0"
		Else
			SQL = "Select count(SoftID) from NC_SoftInfo Where softTime>=Date()"
		End If
		Rs.Open SQL, Conn, 1, 1
		DayUpdateSoft = Rs(0)
		If IsNull(DayUpdateSoft) Then DayUpdateSoft = 0
		Rs.Close

		SQL = "Select sum(Hits) from NC_SoftInfo"
		Rs.Open SQL, Conn, 1, 1
		AllDownNum = Rs(0)
		If IsNull(AllDownNum) Then AllDownNum = 0
		Rs.Close

		SQL = "Select sum(SoftSize) from NC_SoftInfo"
		Rs.Open SQL, Conn, 1, 1
		If Rs.bof And Rs.EOF Then
			AllSoftSize = 0
		Else
			If IsNull(Rs(0)) Then
				AllSoftSize = 0
			Else
				AllSoftSize = Round(Rs(0) / 1024 / 1024, 3)
			End If
		End If
		Rs.Close

		SQL = "Select count(ID) from NC_Article"
		Rs.Open SQL, Conn, 1, 1
		AllArticle = Rs(0)
		If IsNull(AllArticle) Then AllArticle = 0
		Rs.Close

		If Newasp.isSqlDataBase = 1 Then
			SQL = "Select count(ID) from NC_Article Where datediff(d,infoTime,GetDate())=0"
		Else
			SQL = "Select count(ID) from NC_Article Where infoTime >= Date()"
		End If
		Rs.Open SQL, Conn, 1, 1
		DayUpdateArt = Rs(0)
		If IsNull(DayUpdateArt) Then DayUpdateArt = 0
		Rs.Close

		SQL = "Select sum(Hits) from NC_Article"
		Rs.Open SQL, Conn, 1, 1
		AllArticleHits = Rs(0)
		If IsNull(AllArticleHits) Then AllArticleHits = 0
		Rs.Close

		SQL = "Select count(userid) from NC_User"
		Rs.Open SQL, Conn, 1, 1
		AllUserNum = Rs(0)
		If IsNull(AllUserNum) Then AllUserNum = 0
		Rs.Close
		HtmlString = Newasp.mainset(12)
		HtmlString = Replace(HtmlString, "{$AllSoft}", AllSoft)
		HtmlString = Replace(HtmlString, "{$DayUpdateSoft}", DayUpdateSoft)
		HtmlString = Replace(HtmlString, "{$AllDownNum}", AllDownNum)
		HtmlString = Replace(HtmlString, "{$AllSoftSize}", AllSoftSize)
		HtmlString = Replace(HtmlString, "{$AllArticle}", AllArticle)
		HtmlString = Replace(HtmlString, "{$DayUpdateArt}", DayUpdateArt)
		HtmlString = Replace(HtmlString, "{$AllArticleHits}", AllArticleHits)
		HtmlString = Replace(HtmlString, "{$AllUserNum}", AllUserNum)
		Set Rs = Nothing
		Statistics = HtmlString
	End Function
	'*************************************************************
	'函数作用:文章类型
	'*************************************************************
	Private Function CreateArticleType()
		Dim Rs, SQL, InfoTime, Title, HtmlString, Topic, ClassName, i, TypeUrl, InfoDate
		Set Rs = Server.CreateObject("adodb.recordset")
		HtmlString = HtmlString & "<TABLE width=""100%"" cellSpacing=5 cellPadding=1 border=0>" & vbCrLf
		HtmlString = HtmlString & " <TR vAlign=top>" & vbCrLf
		Dim ArticleType
		ArticleType = Split(Newasp.Setting(36), ",")
		For i = 0 To UBound(ArticleType)
			HtmlString = HtmlString & "    <TD vAlign=top width=""50%"">" & vbCrLf
			SQL = "SELECT top " & CInt(Newasp.TempSet(3)) & " ID,Classid,Title,ClassName,ArticleType,InfoTime,Hits FROM NC_Article where ArticleType='" & Trim(ArticleType(i)) & "' order by InfoTime desc,ID desc"
			Rs.Open SQL, Conn, 1, 1
			HtmlString = HtmlString & Newasp.TempSet(6)
			If CInt(Newasp.Setting(5)) = 0 Then
				TypeUrl = Newasp.SetupDir & "Article/NewArticle" & i & ".html"
			Else
				TypeUrl = Newasp.SetupDir & "NewArticle.Asp?type=" & Trim(ArticleType(i))
			End If
			HtmlString = Replace(HtmlString, "{$TypeName}", Trim(ArticleType(i)))
			HtmlString = Replace(HtmlString, "{$ArticleTypeUrl}", TypeUrl)
			If Rs.EOF And Rs.bof Then
				HtmlString = HtmlString & "<p align=center>还没有任何文章!</p>"
			Else
				Do While Not Rs.EOF
					HtmlString = HtmlString & Newasp.TempSet(7)
					If Rs("InfoTime") >= Date Then
						InfoTime = "<FONT color=red>" & Month(Rs("InfoTime")) & "/" & Day(Rs("InfoTime")) & "</FONT >"
						InfoDate = "<FONT color=red>" & FormatDateTime(Rs("InfoTime"), 2) & "</FONT >"
					Else
						InfoTime = "<FONT color=#999999>" & Month(Rs("InfoTime")) & "/" & Day(Rs("InfoTime")) & "</FONT >"
						InfoDate = "<FONT color=#999999>" & FormatDateTime(Rs("InfoTime"), 2) & "</FONT >"
					End If
					If CInt(Newasp.Setting(5)) = 0 Then
						Topic = "<A HREF='" & Newasp.SetupDir & "Article/Catalog" & Rs("ClassID") & "/" & Rs("id") & ".html' title='文章标题: " & Rs("Title") & "<BR>更新时间: " & Rs("InfoTime") & "<BR>浏览次数: " & Rs("Hits") & "' class='TableLink'>" & Newasp.gotTopic(Rs("Title"), CInt(Newasp.TempSet(4))) & "</A>"
						ClassName = "<A HREF='" & Newasp.SetupDir & "Listing/Catalog" & Rs("ClassID") & "/Listing_Indete_Desc_1.html' title='" & Rs("ClassName") & "'>" & Rs("ClassName") & "</A>"
					Else
						Topic = "<A HREF='" & Newasp.SetupDir & "Article.Asp?id=" & Rs("id") & "' title='文章标题:" & Rs("Title") & "<BR>更新时间: " & Rs("InfoTime") & "<BR>浏览次数: " & Rs("Hits") & "' class='TableLink'>" & Newasp.gotTopic(Rs("Title"), CInt(Newasp.TempSet(4))) & "</A>"
						ClassName = "<A HREF='" & Newasp.SetupDir & "Listing.Asp?ClassID=" & Rs("ClassID") & "' title='" & Rs("ClassName") & "'>" & Rs("ClassName") & "</A>"
					End If
					HtmlString = Replace(HtmlString, "{$Topic}", Topic)
					HtmlString = Replace(HtmlString, "{$ClassName}", ClassName)
					HtmlString = Replace(HtmlString, "{$InfoTime}", InfoTime)
					HtmlString = Replace(HtmlString, "{$InfoDate}", InfoDate)
					Rs.movenext
				Loop
			End If
			HtmlString = HtmlString & Newasp.TempSet(8)
			Rs.Close

			HtmlString = HtmlString & "</TD>" & vbCrLf
			If (i Mod CInt(Newasp.TempSet(5))) = (CInt(Newasp.TempSet(5)) - 1) Then HtmlString = HtmlString & "</tr><tr>"
		Next
		HtmlString = HtmlString & " </TR>" & vbCrLf
		HtmlString = HtmlString & "</TABLE>" & vbCrLf
		Set Rs = Nothing
		CreateArticleType = HtmlString
	End Function
	'*************************************************************
	'函数作用:图片推荐
	'*************************************************************
	Private Function ArticleImage()
		Dim Rs, SQL, HtmlString, Topic, images
		Set Rs = Server.CreateObject("adodb.recordset")
		SQL = "select Top " & CInt(Newasp.TempSet(9)) & " id,ClassID,title,images from NC_Article where isLock = 0 And images <>'' order by InfoTime desc, id desc"
		Rs.Open SQL, Conn, 1, 1
		If Rs.bof And Rs.EOF Then
			HtmlString = "<img src=""" & Newasp.SetupDir & "images/NoPic.jpg"" width='" & Newasp.TempSet(20) & "' height='" & Newasp.TempSet(21) & "' border=0>"
		Else
			HtmlString = Newasp.TempSet(11)
			Do While Not Rs.EOF
				If CInt(Newasp.Setting(5)) = 0 Then
					Topic = "<A HREF='" & Newasp.SetupDir & "Article/Catalog" & Rs("classid") & "/" & Rs("id") & ".html' title='" & Rs("title") & "'>" & Newasp.gotTopic(Rs("title"), CInt(Newasp.TempSet(10))) & "</A>"
					images = "<A HREF='" & Newasp.SetupDir & "Article/Catalog" & Rs("classid") & "/" & Rs("id") & ".html' title='" & Rs("title") & "'><img src='" & Rs("images") & "' width='" & Newasp.TempSet(20) & "' height='" & Newasp.TempSet(21) & "' border='0'></A>"
				Else
					Topic = "<A HREF='" & Newasp.SetupDir & "Article.Asp?id=" & Rs("id") & "' title='" & Rs("title") & "'>" & Newasp.gotTopic(Rs("title"), CInt(Newasp.TempSet(10))) & "</A>"
					images = "<A HREF='" & Newasp.SetupDir & "Article.Asp?id=" & Rs("id") & "' title='" & Rs("title") & "'><img src='" & Rs("images") & "' width='" & Newasp.TempSet(20) & "' height='" & Newasp.TempSet(21) & "' border='0'></A>"
				End If
				HtmlString = HtmlString & Newasp.TempSet(12)
				HtmlString = Replace(HtmlString, "{$Images}", images)
				HtmlString = Replace(HtmlString, "{$Topic}", Topic)
				Rs.movenext
			Loop
			HtmlString = HtmlString & Newasp.TempSet(13)
		End If
		Rs.Close
		Set Rs = Nothing
		ArticleImage = HtmlString
	End Function

	Private Function SingleImage(orders)
		Dim Rs, SQL, HtmlString, Topic, images, OrderName
		Set Rs = Server.CreateObject("adodb.recordset")
		If orders = "Hits" Then
			OrderName = "Hits"
		Else
			OrderName = "InfoTime"
		End If
		SQL = "select Top 1 id,classid,title,images from NC_Article where isLock = 0 And images <>'' order by " & OrderName & " desc, id desc"
		Rs.Open SQL, Conn, 1, 1
		If Rs.bof And Rs.EOF Then
			HtmlString = "<img src=""" & Newasp.SetupDir & "images/NoPic.jpg"" width='" & Newasp.TempSet(20) & "' height='" & Newasp.TempSet(21) & "' border=0>"
		Else
			If CInt(Newasp.Setting(5)) = 0 Then
				images = "<A HREF='" & Newasp.SetupDir & "Article/Catalog" & Rs("classid") & "/" & Rs("id") & ".html' title='" & Rs("title") & "'><img src='" & Rs("images") & "' width='" & Newasp.TempSet(20) & "' height='" & Newasp.TempSet(21) & "' border='0'></A>"
			Else
				images = "<A HREF='" & Newasp.SetupDir & "Article.Asp?id=" & Rs("id") & "' title='" & Rs("title") & "'><img src='" & Rs("images") & "' width='" & Newasp.TempSet(20) & "' height='" & Newasp.TempSet(21) & "' border='0'></A>"
			End If
			HtmlString = images
		End If
		Rs.Close
		Set Rs = Nothing
		SingleImage = HtmlString
	End Function
End Class
%>

⌨️ 快捷键说明

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