create_softindexcls.asp

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

ASP
594
字号
<%
Class Create_SoftIndex_Cls
	Private ErrMsg
	Private SucMsg
	Private Founderr
	Private NC_Admin
	Private Sub Class_Initialize()
		Founderr = False
	End Sub

	Private Sub Class_Terminate()
		If IsObject(Conn) Then
			Conn.Close
			Set Conn = Nothing
		End If
		Set Newasp = Nothing
	End Sub

	Public Sub Init_IndexHtml()
		Response.Buffer = True
		Dim CreateHtml, FSO, Fout
		Set NC_Admin = New Check
		NC_Admin.AdminChk = "31"
		NC_Admin.Check
		Newasp.admin_header
		If Not Newasp.IsObjectFSO(Newasp.Script_FSO) Then
			Response.Write "<b><font color=red>你的服务器不支持 FSO(Scripting.FileSystemObject)! 首页文件没有生成</font></b>"
		Else
			Set FSO = Server.CreateObject(Newasp.Script_FSO)
			CreateHtml = Server.MapPath(Newasp.SetupDir & Newasp.Setting(6))
			Set Fout = FSO.CreateTextFile(CreateHtml)
			Fout.WriteLine CreateHtmlFile
			Fout.Close
			Set Fout = Nothing
			Set FSO = Nothing
			NC_Admin.Succeed_Msg ("生成下载首页成功!")
			If CInt(Newasp.Setting(5)) = 1 Then
				Response.Write "<meta http-equiv=""refresh"" content=""2;url='admin_software.asp'"">"
			Else
				Response.Write "<meta http-equiv=""refresh"" content=""2;url='Create_Sorting.Asp'"">"
			End If
		End If
		Newasp.admin_footer
	End Sub

	Public Sub IndexHtml()
		Response.Buffer = True
		If CInt(Newasp.Setting(5)) = 0 Then
			Response.redirect (Newasp.SetupDir & Newasp.Setting(6))
		Else
			Response.Write CreateHtmlFile
		End If
	End Sub
	'*************************************************************
	'函数作用:下载排行 hitsID=0:下载总排行 hitsID=1:本日下载排行
	'*************************************************************
	Private Function DownLoadTop(HitsID)
		Dim Rs, SQL, HtmlString, OrderName, SoftName
		Select Case CInt(HitsID)
			Case 1
				OrderName = "DayHits"
			Case 2
				OrderName = "WeekHits"
			Case 3
				OrderName = "MonthHits"
			Case Else
				OrderName = "Hits"
		End Select
		Set Rs = Server.CreateObject("adodb.recordset")
		SQL = "select Top " & CInt(Newasp.mainset(13)) & " softid,sortid,SoftName,SoftVer, " & OrderName & ", SoftTime from NC_SoftInfo where isLock = 0 order by " & OrderName & " desc, SoftTime desc, softid desc"
		Rs.Open SQL, Conn, 1, 1
		If Rs.bof And Rs.EOF Then
			HtmlString = "还没有排行软件!"
		Else
			Do While Not Rs.EOF
				If CInt(Newasp.Setting(5)) = 0 Then
					SoftName = "<A HREF='" & Newasp.SetupDir & "Software/Catalog" & Rs(1) & "/" & Rs(0) & ".html' title='软件名称: " & Rs(2) & Rs(3) & "<BR>更新时间: " & Rs(5) & "<BR>下载次数: " & Rs(4) & "'>" & Newasp.gotTopic(Rs(2) & Rs(3), CInt(Newasp.mainset(14))) & "</A>"
				Else
					SoftName = "<A HREF='" & Newasp.SetupDir & "Software.asp?id=" & Rs(0) & "' title='软件名称: " & Rs(2) & Rs(3) & "<BR>更新时间: " & Rs(5) & "<BR>下载次数: " & Rs(4) & "'>" & Newasp.gotTopic(Rs(2) & Rs(3), CInt(Newasp.mainset(14))) & "</A>"
				End If
				HtmlString = HtmlString & Newasp.mainset(15)
				HtmlString = Replace(HtmlString, "{$SoftTopName}", SoftName)
				HtmlString = Replace(HtmlString, "{$SoftHits}", Rs(4))
				Rs.movenext
			Loop
		End If
		Rs.Close
		Set Rs = Nothing
		DownLoadTop = HtmlString
	End Function
	'*************************************************************
	'函数作用:热门文章 hitsID=0:总浏览排行文章 hitsID=1:本日浏览排行
	'*************************************************************
	Private Function ArticleHits(HitsID)
		Dim Rs, SQL, HtmlString, OrderName, ArticleTitle
		Select Case CInt(HitsID)
			Case 1
				OrderName = "DayHits"
			Case 2
				OrderName = "WeekHits"
			Case 3
				OrderName = "MonthHits"
			Case Else
				OrderName = "Hits"
		End Select
		Set Rs = Server.CreateObject("adodb.recordset")
		SQL = "select Top " & CInt(Newasp.mainset(16)) & " id,classid,Title, " & OrderName & ", InfoTime from NC_Article where isLock = 0 order by " & OrderName & " desc, InfoTime desc, id desc"
		Rs.Open SQL, Conn, 1, 1
		If Rs.bof And Rs.EOF Then
			HtmlString = "还没有排行文章!"
		Else
			Do While Not Rs.EOF
				If CInt(Newasp.Setting(5)) = 0 Then
					ArticleTitle = "<A HREF='" & Newasp.SetupDir & "Article/Catalog" & Rs(1) & "/" & Rs(0) & ".html' title='文章标题: " & Rs(2) & "<BR>更新时间: " & Rs(4) & "<BR>浏览次数: " & Rs(3) & "'>" & Newasp.gotTopic(Rs(2), CInt(Newasp.mainset(17))) & "</A>"
				Else
					ArticleTitle = "<A HREF='" & Newasp.SetupDir & "Article.asp?id=" & Rs(0) & "' title='文章标题: " & Rs(2) & "<BR>更新时间: " & Rs(4) & "<BR>浏览次数: " & Rs(3) & "'>" & Newasp.gotTopic(Rs(2), CInt(Newasp.mainset(17))) & "</A>"
				End If
				HtmlString = HtmlString & Newasp.mainset(18)
				HtmlString = Replace(HtmlString, "{$ArticleTitle}", ArticleTitle)
				HtmlString = Replace(HtmlString, "{$ArticleHits}", Rs(3))
				Rs.movenext
			Loop
		End If
		Rs.Close
		Set Rs = Nothing
		ArticleHits = HtmlString
	End Function
	'*************************************************************
	'函数作用:最新加入文章
	'*************************************************************
	Private Function NewArticle()
		Dim Rs, SQL, HtmlString, ArticleTitle, ClassName, InfoTime, InfoDate
		Set Rs = Server.CreateObject("adodb.recordset")
		SQL = "select Top " & CInt(Newasp.mainset(19)) & " id,classid,Title, ClassName,InfoTime,Hits from NC_Article where isLock = 0 order by InfoTime desc, id desc"
		Rs.Open SQL, Conn, 1, 1
		If Rs.bof And Rs.EOF Then
			HtmlString = "还没有最新文章!"
		Else
			Do While Not Rs.EOF
				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
					ArticleTitle = "<A HREF='" & Newasp.SetupDir & "Article/Catalog" & Rs(1) & "/" & Rs(0) & ".html' title='" & Rs(2) & "' class='TableLink'>" & Newasp.gotTopic(Rs(2), CInt(Newasp.mainset(20))) & "</A>"
					ClassName = "<A HREF='" & Newasp.SetupDir & "Listing/Catalog" & Rs(1) & "/Listing_Indate_Desc_1.html' title='" & Rs("ClassName") & "'>" & Rs("ClassName") & "</A>"
				Else
					ArticleTitle = "<A HREF='" & Newasp.SetupDir & "Article.asp?id=" & Rs(0) & "' title='" & Rs(2) & "' class='TableLink'>" & Newasp.gotTopic(Rs(2), CInt(Newasp.mainset(20))) & "</A>"
					ClassName = "<A HREF='" & Newasp.SetupDir & "Listing.asp?classid=" & Rs(1) & "' title='" & Rs("ClassName") & "'>" & Rs("ClassName") & "</A>"
				End If
				HtmlString = HtmlString & Newasp.mainset(21)
				HtmlString = Replace(HtmlString, "{$ArticleTitle}", ArticleTitle)
				HtmlString = Replace(HtmlString, "{$ClassName}", ClassName)
				HtmlString = Replace(HtmlString, "{$InfoTime}", InfoTime)
				HtmlString = Replace(HtmlString, "{$ArticleHits}", Rs("Hits"))
				HtmlString = Replace(HtmlString, "{$InfoDate}", InfoDate)
				Rs.movenext
			Loop
		End If
		Rs.Close
		Set Rs = Nothing
		NewArticle = HtmlString
	End Function
	'*************************************************************
	'函数作用:推荐文章
	'*************************************************************
	Private Function BestArticle()
		Dim Rs, SQL, HtmlString, ArticleTitle, ClassName, InfoTime, InfoDate
		Set Rs = Server.CreateObject("adodb.recordset")
		SQL = "select Top " & CInt(Newasp.mainset(19)) & " id,classid,Title, ClassName,InfoTime,Hits,isTop from NC_Article where isLock = 0 And isCommend = 1 order by isTop desc, InfoTime desc, id desc"
		Rs.Open SQL, Conn, 1, 1
		If Rs.bof And Rs.EOF Then
			HtmlString = "还没有推荐文章!"
		Else
			Do While Not Rs.EOF
				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
					ArticleTitle = "<A HREF='" & Newasp.SetupDir & "Article/Catalog" & Rs(1) & "/" & Rs(0) & ".html' title='" & Rs(2) & "' class='TableLink'>" & Newasp.gotTopic(Rs(2), CInt(Newasp.mainset(20))) & "</A>"
					ClassName = "<A HREF='" & Newasp.SetupDir & "Listing/Catalog" & Rs(1) & "/Listing_Indate_Desc_1.html' title='" & Rs("ClassName") & "'>" & Rs("ClassName") & "</A>"
				Else
					ArticleTitle = "<A HREF='" & Newasp.SetupDir & "Article.asp?id=" & Rs(0) & "' title='" & Rs(2) & "' class='TableLink'>" & Newasp.gotTopic(Rs(2), CInt(Newasp.mainset(20))) & "</A>"
					ClassName = "<A HREF='" & Newasp.SetupDir & "Listing.asp?classid=" & Rs(1) & "' title='" & Rs("ClassName") & "'>" & Rs("ClassName") & "</A>"
				End If
				HtmlString = HtmlString & Newasp.mainset(21)
				HtmlString = Replace(HtmlString, "{$ArticleTitle}", ArticleTitle)
				HtmlString = Replace(HtmlString, "{$ClassName}", ClassName)
				HtmlString = Replace(HtmlString, "{$InfoTime}", InfoTime)
				HtmlString = Replace(HtmlString, "{$ArticleHits}", Rs("Hits"))
				HtmlString = Replace(HtmlString, "{$InfoDate}", InfoDate)
				Rs.movenext
			Loop
		End If
		Rs.Close
		Set Rs = Nothing
		BestArticle = HtmlString
	End Function
	'*************************************************************
	'函数作用:最近更新软件
	'*************************************************************
	Private Function DayNewSoft()
		Dim Rs, SQL, HtmlString, SoftName, SortName, SoftTime, SoftDate
		Set Rs = Server.CreateObject("adodb.recordset")
		SQL = "select Top " & CInt(Newasp.mainset(22)) & " softid,sortid,SoftName, SoftVer,SortName,SoftTime,Hits from NC_SoftInfo where isLock = 0 order by SoftTime desc, softid desc"
		Rs.Open SQL, Conn, 1, 1
		If Rs.bof And Rs.EOF Then
			HtmlString = "还没有更新软件!"
		Else
			Do While Not Rs.EOF
				If Rs("SoftTime") >= Date Then
					SoftTime = "<FONT color=red>" & Month(Rs("SoftTime")) & "/" & Day(Rs("SoftTime")) & "</FONT >"
					SoftDate = "<FONT color=red>" & FormatDateTime(Rs("SoftTime"), 2) & "</FONT >"
				Else
					SoftTime = "<FONT color=#999999>" & Month(Rs("SoftTime")) & "/" & Day(Rs("SoftTime")) & "</FONT >"
					SoftDate = "<FONT color=red>" & FormatDateTime(Rs("SoftTime"), 2) & "</FONT >"
				End If
				If CInt(Newasp.Setting(5)) = 0 Then
					SoftName = "<A HREF='" & Newasp.SetupDir & "Software/Catalog" & Rs(1) & "/" & Rs(0) & ".html' title='" & Rs("SoftName") & Rs("SoftVer") & "' class='TableLink'>" & Newasp.gotTopic(Rs("SoftName") & Rs("SoftVer"), CInt(Newasp.mainset(23))) & "</A>"
					SortName = "<A HREF='" & Newasp.SetupDir & "Sorting/Catalog" & Rs(1) & "/Sorting_Indate_Desc_1.html' title='" & Rs("SortName") & "'>" & Rs("SortName") & "</A>"
				Else
					SoftName = "<A HREF='" & Newasp.SetupDir & "Software.asp?id=" & Rs(0) & "' title='" & Rs("SoftName") & Rs("SoftVer") & "' class='TableLink'>" & Newasp.gotTopic(Rs("SoftName") & Rs("SoftVer"), CInt(Newasp.mainset(20))) & "</A>"
					SortName = "<A HREF='" & Newasp.SetupDir & "Sorting.asp?sortid=" & Rs(1) & "' title='" & Rs("SoftName") & Rs("SoftVer") & "'>" & Rs("SortName") & "</A>"
				End If
				HtmlString = HtmlString & Newasp.mainset(24)
				HtmlString = Replace(HtmlString, "{$SoftName}", SoftName)
				HtmlString = Replace(HtmlString, "{$SortName}", SortName)
				HtmlString = Replace(HtmlString, "{$SoftTime}", SoftTime)
				HtmlString = Replace(HtmlString, "{$SoftHits}", Rs("Hits"))
				HtmlString = Replace(HtmlString, "{$SoftDate}", SoftDate)
				Rs.movenext
			Loop
		End If
		Rs.Close
		Set Rs = Nothing
		DayNewSoft = HtmlString
	End Function
	'*************************************************************
	'函数作用:推荐软件
	'*************************************************************
	Private Function CommendSoft()
		Dim Rs, SQL, HtmlString, SoftName, SortName, SoftTime, SoftDate
		Set Rs = Server.CreateObject("adodb.recordset")
		SQL = "select Top " & CInt(Newasp.mainset(22)) & " softid,sortid,SoftName, SoftVer,SortName,SoftTime,Hits,isTop from NC_SoftInfo where isLock = 0 And isCommend = 1 order by isTop desc, SoftTime desc, softid desc"
		Rs.Open SQL, Conn, 1, 1
		If Rs.bof And Rs.EOF Then
			HtmlString = "还没有推荐软件!"
		Else
			Do While Not Rs.EOF
				If Rs("SoftTime") >= Date Then
					SoftTime = "<FONT color=red>" & Month(Rs("SoftTime")) & "/" & Day(Rs("SoftTime")) & "</FONT >"
					SoftDate = "<FONT color=red>" & FormatDateTime(Rs("SoftTime"), 2) & "</FONT >"
				Else
					SoftTime = "<FONT color=#999999>" & Month(Rs("SoftTime")) & "/" & Day(Rs("SoftTime")) & "</FONT >"
					SoftDate = "<FONT color=#999999>" & FormatDateTime(Rs("SoftTime"), 2) & "</FONT >"
				End If
				If CInt(Newasp.Setting(5)) = 0 Then
					SoftName = "<A HREF='" & Newasp.SetupDir & "Software/Catalog" & Rs(1) & "/" & Rs(0) & ".html' title='" & Rs("SoftName") & Rs("SoftVer") & "' class='TableLink'>" & Newasp.gotTopic(Rs("SoftName") & Rs("SoftVer"), CInt(Newasp.mainset(23))) & "</A>"
					SortName = "<A HREF='" & Newasp.SetupDir & "Sorting/Catalog" & Rs(1) & "/Sorting_Indate_Desc_1.html' title='" & Rs("SortName") & "'>" & Rs("SortName") & "</A>"
				Else
					SoftName = "<A HREF='" & Newasp.SetupDir & "Software.asp?id=" & Rs(0) & "' title='" & Rs("SoftName") & Rs("SoftVer") & "' class='TableLink'>" & Newasp.gotTopic(Rs("SoftName") & Rs("SoftVer"), CInt(Newasp.mainset(23))) & "</A>"
					SortName = "<A HREF='" & Newasp.SetupDir & "Sorting.asp?sortid=" & Rs(1) & "' title='" & Rs("SoftName") & Rs("SoftVer") & "'>" & Rs("SortName") & "</A>"
				End If
				If Rs("isTop") = 1 Then SoftName = "<FONT color=red>" & SoftName & "</Font>"
				HtmlString = HtmlString & Newasp.mainset(24)
				HtmlString = Replace(HtmlString, "{$SoftName}", SoftName)
				HtmlString = Replace(HtmlString, "{$SortName}", SortName)
				HtmlString = Replace(HtmlString, "{$SoftTime}", SoftTime)
				HtmlString = Replace(HtmlString, "{$SoftHits}", Rs("Hits"))
				HtmlString = Replace(HtmlString, "{$SoftDate}", SoftDate)
				Rs.movenext
			Loop
		End If
		Rs.Close
		Set Rs = Nothing
		CommendSoft = HtmlString
	End Function
	'*************************************************************
	'函数作用:站内公告
	'*************************************************************
	Private Function WebMessage(statid)
		Dim Rs, SQL, HtmlString, MsgTitle, PostTime
		Set Rs = Server.CreateObject("adodb.recordset")
		SQL = "select Top " & CInt(Newasp.mainset(25)) & " * from NC_Message where statid in (0, " & statid & ") order by isTop desc, Postime desc, id desc"
		Rs.Open SQL, Conn, 1, 1
		If Rs.bof And Rs.EOF Then
			HtmlString = "没有公告!"
		Else
			Do While Not Rs.EOF
				If Rs("Postime") >= Date Then

⌨️ 快捷键说明

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