www.gusucode.com > 艺术签名文章资讯网源代码 > 艺术签名文章资讯网源代码/624/soft/softdown.asp

    <!--#include file="config.asp"-->
<%
On Error Resume Next

Dim Rs,SQL,HtmlContent
Dim softid,SoftName,PauseDown,SoftSize
Dim SoftContent,SoftTime,AllHits,filesize
Dim ChannelRootDir,strInstallDir,strIndexName
Dim HtmlFileUrl,HtmlFileName,strUrl,RandomCodes
Dim subtitle,HeaderTitle,HeaderTitles
Dim classid,m_strClassName,m_strClassURL
Dim m_strAdsCode,m_intstopad,strBasicPath
Dim m_intType,downid,id,ShowDownUrl
Dim isxmltext,xmlfilename,xmlFilePath
ShowDownUrl = ""
Newasp.ReadChannel(ChannelID)

If Newasp.BindDomain = "0" Then
	ChannelRootDir = Newasp.InstallDir & Newasp.ChannelDir
	strBasicPath = ""
	strInstallDir = Newasp.InstallDir
Else
	ChannelRootDir = "/"
	strInstallDir = Newasp.SiteUrl & "/"
	If Len(Newasp.NamedPath) > 2 Then
		strBasicPath = Newasp.NamedPath
	Else
		strBasicPath = Server.MapPath(Newasp.InstallDir & Newasp.ChannelDir)
	End If
	
End If
ubb.BasePath = ChannelRootDir
ubb.setUbbcode = Join(Newasp.setUserEditor,"|")
ubb.Keyword = Newasp.ContentKeyword
strIndexName = "<a href=""" & ChannelRootDir & """>" & Newasp.ChannelName & "</a>"
softid = Newasp.ChkNumeric(Request.Querystring("softid"))
downid = Newasp.ChkNumeric(Request.Querystring("downid"))
id = Newasp.ChkNumeric(Request.Querystring("n"))
m_intType = Newasp.ChkNumeric(Request.Querystring("type"))
If softid = 0 Then
	OutAlertScript("错误的系统参数!请输入正确的软件ID")
	Response.End
End If

Newasp.LoadTemplates ChannelID, 6, Newasp.ChannelSkin
HtmlContent = Newasp.HtmlContent
HtmlContent = Replace(HtmlContent, "{$ChannelRootDir}", ChannelRootDir)
HtmlContent = Replace(HtmlContent, "{$InstallDir}", strInstallDir)
HtmlContent = Replace(HtmlContent, "{$ChannelID}", ChannelID)
HtmlContent = Replace(HtmlContent, "{$ModuleName}", Newasp.ModuleName)
HtmlContent = Replace(HtmlContent, "{$SoftIndex}", strIndexName)
HtmlContent = Replace(HtmlContent, "{$IndexTitle}", strIndexName)


SQL = "SELECT A.softid,A.classid,A.SoftName,A.SoftVer,A.subtitle,A.Content,A.SoftSize,A.SoftTime,A.AllHits,A.HtmlFileDate,A.PauseDown,A.isxmltext,A.xmlfilename,C.HtmlFileDir FROM NC_SoftList A INNER JOIN [NC_Classify] C On A.ClassID=C.ClassID WHERE A.ChannelID="& ChannelID &" And A.isAccept <> 0 And A.softid=" & softid
If IsSqlDataBase = 1 Then
	Set Rs = Newasp.Execute ("Execute NC_ShowSoftContent "& ChannelID &","& softid)
Else
	Set Rs = Newasp.Execute(SQL)
End If
If Rs.EOF And Rs.BOF Then
	OutAlertScript("对不起~!没有找到你想下载的软件。")
	Set Rs = Nothing
	Response.End
Else
	SoftName = Trim(Rs("SoftName") &" "& Rs("SoftVer"))
	PauseDown = Rs("PauseDown")
	SoftTime = Rs("SoftTime")
	AllHits = Rs("AllHits")
	classid = Rs("classid")
	'--副标题
	subtitle = Trim(Rs("subtitle") & "")
	'--如果是XML文件,就从XML文件中读出内容------
	isxmltext = Newasp.ChkNumeric(Rs("isxmltext"))
	xmlfilename = Rs("xmlfilename") & ""
	If isxmltext = 1 Then
		xmlFilePath = NewCloud.m_strXMLPath & xmlfilename
		SoftContent = Newasp.ReadXMLDocument(xmlFilePath,"softinfo/@content")
		If SoftContent = "" Then SoftContent = Rs("content") & ""
		SoftContent = ubb.Ubbcode(SoftContent)
	Else
		SoftContent = ubb.Ubbcode(Rs("Content"))
	End If
	'---------------------------------------------
	If CLng(Rs("SoftSize")) > 0 Then
		SoftSize = ReadSoftsize(Rs("SoftSize"))
	Else
		SoftSize = "未知大小"
	End If
	filesize = CCur(Rs("SoftSize"))
	If CInt(Newasp.IsCreateHtml) <> 0 Then
		HtmlFileUrl = Newasp.ReadDestination(Newasp.InfoDestination, Newasp.ChannelDir, Rs("HtmlFileDate"),Rs("HtmlFileDir"),Rs("ClassID"),Rs("softid"),1,"")
		m_strClassURL = Newasp.ReadDestination(Newasp.SortDestination, Newasp.ChannelDir, Rs("HtmlFileDate"),Rs("HtmlFileDir"),Rs("ClassID"),Rs("softid"),1,"")
		strUrl = HtmlFileUrl
	Else
		If IsURLRewrite Then
			strUrl = ChannelRootDir & Rs("softid") & Newasp.HtmlExtName
			m_strClassURL = ChannelRootDir & "list_1_" & classid & Newasp.HtmlExtName
		Else
			strUrl = ChannelRootDir & "show.asp?id="& Rs("softid")
			m_strClassURL = ChannelRootDir & "list.asp?classid=" & classid
		End If
	End If
End If
Rs.Close:Set Rs = Nothing
Set Rs = Newasp.Execute("SELECT ClassName,AdsCode,stopad FROM NC_Classify WHERE classid=" & CLng(classid))
If Rs.EOF And Rs.BOF Then
	m_strClassName = "没有找到分类"
	m_strAdsCode = ""
	m_intstopad = 1
Else
	m_strClassName = Rs("ClassName")
	m_strAdsCode = Rs("AdsCode") & ""
	m_intstopad = Rs("stopad")
End If
Set Rs = Nothing
m_strClassURL = "<a href=""" & m_strClassURL & """>" & m_strClassName & "</a>"

HtmlContent = Replace(HtmlContent, "{$PageTitle}", SoftName)
HtmlContent = Replace(HtmlContent, "{$SoftID}", softid)
HtmlContent = Replace(HtmlContent, "{$softid}", softid)
HtmlContent = Replace(HtmlContent, "{$ClassID}", classid)
HtmlContent = Replace(HtmlContent, "{$ClassName}", m_strClassName)
HtmlContent = Replace(HtmlContent, "{$strClassName}", m_strClassURL)
HtmlContent = Replace(HtmlContent, "{$strUrl}", strUrl)
HtmlContent = Replace(HtmlContent, "{$Updatetime}", SoftTime)
HtmlContent = Replace(HtmlContent, "{$SoftSize}", SoftSize)
HtmlContent = Replace(HtmlContent, "{$FileSize}", FileSize)
HtmlContent = Replace(HtmlContent, "{$AllHits}", AllHits)
If m_intType = 1 Then
	HtmlContent = Replace(HtmlContent, "{$ShowDownAddress}", ShowOneAddress)
Else
	HtmlContent = Replace(HtmlContent, "{$ShowDownAddress}", ShowDownAddress(softid))
End If
HtmlContent = Replace(HtmlContent, "{$ShowDownUrl}", ShowDownUrl)
HtmlContent = NewCloud.GetDescription(HtmlContent, SoftContent)
If InStr(HtmlContent, "{$Description}") > 0 Then
	HtmlContent = Replace(HtmlContent, "{$Description}", Newasp.CutString(SoftContent,180))
End If
If InStr(HtmlContent, "{$BackAndNextSoft}") > 0 Then
	HtmlContent = Replace(HtmlContent, "{$BackAndNextSoft}", BackAndNextSoftware(softid))
End If
If len(subtitle) = 0 Then
	HeaderTitle = ""
	HeaderTitles = ""
Else
	HeaderTitle = subtitle
	HeaderTitles = " - " & subtitle
End If
HtmlContent = Replace(HtmlContent, "{$HeaderTitle}", HeaderTitle)
HtmlContent = Replace(HtmlContent, "{$HeaderTitles}", HeaderTitles)
HtmlContent = ReadClassMenu(HtmlContent)
HtmlContent = ReadClassMenubar(HtmlContent)
HtmlContent = HTML.ReadAnnounceList(HtmlContent)
HtmlContent = HTML.ReadStatistic(HtmlContent)
HtmlContent = HTML.ReadUserRank(HtmlContent)
RandomCodes = GetRandomizeCode
'-- 新增分类广告代码
HtmlContent = AdsReplace(HtmlContent,m_strAdsCode,m_intstopad)
HtmlContent = Replace(HtmlContent, "{$RandomCodes}", RandomCodes)
HtmlContent = Replace(HtmlContent, "{$SkinPath}", Newasp.SkinPath)
HtmlContent = Replace(HtmlContent,"{$InstallDir}", Newasp.InstallDir)
HtmlContent = Replace(HtmlContent, "{$SoftName}", SoftName)
HtmlContent = Replace(HtmlContent, "{$SubTitle}", subtitle)
HtmlContent = Replace(HtmlContent, "{$SoftContent}", SoftContent)
Response.Write HtmlContent

'================================================
'函数名:ReadSoftsize
'作  用:读取软件的大小
'================================================
Function ReadSoftsize(para)
	On Error Resume Next
	Dim strFileSize, parasize

	parasize = CCur(para)

	If parasize = 0 Then
		ReadSoftsize = "未知大小"
		Exit Function
	End If
	
	If parasize > 1024 * 1024 + 5200 Then
		strFileSize = FormatRound(Round(parasize / 1024 / 1024, 2)) & " GB"
	ElseIf parasize > 1024 + 5 Then
		strFileSize = FormatRound(Round(parasize / 1024, 2)) & " MB"
	Else
		strFileSize = FormatRound(parasize) & " KB"
	End If
	ReadSoftsize = strFileSize
End Function

Function ShowOneAddress()
	Dim showdown, downrs,oRs
	Dim DownText
	Dim DownloadName, DownloadPath
	Dim DownAddress,selfont,ii,foundstr,n
	showdown = Newasp.ChkNumeric(Newasp.HtmlSetting(1))
	Set downrs = Newasp.Execute("SELECT id,downid,DownFileName,DownText FROM [NC_DownAddress] WHERE id=" & CLng(id))
	If downrs.BOF And downrs.EOF Then
	Else
		DownText = downrs("DownText") & ""
		If Len(DownText) = 0 Then DownText = "立即下载"
		If downrs("downid") > 0 Then
			Set oRs = Newasp.Execute("SELECT downid,DownloadName,DownloadPath,IsDisp,DownPoint,UserGroup,IsOuter,selfont FROM NC_DownServer WHERE ChannelID=" & ChannelID & " And depth=1 And rootid =" & downrs("downid") & " And downid =" & CLng(downid) & " And isLock=0")
			If oRs.EOF And oRs.BOF Then
				DownloadPath = ""
				DownloadName = ""
			Else
					DownAddress = DownAddress & Newasp.HtmlSetting(3)
					'---- 是否直接显示软件直接的下载地址
					If showdown <> 1 Then
						DownloadPath = "download.asp?softid=" & softid & "&downid=" & oRs("downid") & "&id=" & downrs(0)
					Else
						If oRs("IsOuter") <> 1 Then
							DownloadPath = Trim(oRs("DownloadPath") & downrs(2))
						Else
							DownloadPath = Trim(oRs("DownloadPath"))
						End If
					End If
					ShowDownUrl = DownloadPath
					selfont = oRs("selfont") & ""
					If InStr(DownText, "###") > 0 Then
						DownloadName = Replace(oRs("DownloadName"), "{$SoftName}", DownText)
						DownloadName = Replace(DownloadName, "{$Soft_Name}", DownText)
						DownloadName = Replace(DownloadName, "###", "")
						DownAddress = Replace(DownAddress, "{$Soft_Name}", DownText)
						DownAddress = Replace(DownAddress, "{$Title}", DownText)
					Else
						DownloadName = oRs("DownloadName") & ""
						DownloadName = Replace(DownloadName, "{$Soft_Name}", "")
						DownAddress = Replace(DownAddress, "{$Soft_Name}", "")
						DownAddress = Replace(DownAddress, "{$Title}", SoftName)
					End If
					If Len(selfont) > 8 Then
						DownloadName = "<span " & selfont & ">" & DownloadName & "</span>"
					End If
					If oRs("UserGroup") > 0 Then
						DownloadName = Replace(DownloadName, "{$DownPoint}", oRs("DownPoint"))
					Else
						DownloadName = Replace(DownloadName, "{$DownPoint}", 0)
					End If
					DownloadName = Replace(DownloadName, "{$DownText}", DownText)
					DownloadName = Replace(DownloadName, "{$SoftName}", SoftName)
					DownAddress = Replace(DownAddress, "{$downid}", oRs("downid"))
					DownAddress = Replace(DownAddress, "{$DownLoadUrl}", DownloadPath)
					DownAddress = Replace(DownAddress, "{$DownLoadName}", DownloadName)
					DownAddress = Replace(DownAddress, "###", "")
			End If
			Set oRs = Nothing
		Else
			DownAddress = DownAddress & Newasp.HtmlSetting(3)
			If showdown > 0 Then
				DownloadPath = Trim(rsDown("DownFileName") & "")
			Else
				DownloadPath = "download.asp?softid=" & softid & "&downid=0&id=" & downrs(0)
			End If
			ShowDownUrl = DownloadPath
			DownAddress = Replace(DownAddress, "{$ii}", ii)
			DownAddress = Replace(DownAddress, "{$downid}", 0)
			DownAddress = Replace(DownAddress, "{$Soft_Name}", "")
			DownAddress = Replace(DownAddress, "{$Title}", SoftName)
			DownAddress = Replace(DownAddress, "{$DownLoadUrl}", DownloadPath)
			DownAddress = Replace(DownAddress, "{$DownLoadName}", DownText)
			DownAddress = Replace(DownAddress, "###", "")
		End If
	End If
	Set downrs = Nothing
	DownAddress = Replace(DownAddress, "{$SoftName}", SoftName)
	DownAddress = Replace(DownAddress, "{$ChannelRootDir}", ChannelRootDir)
	DownAddress = Replace(DownAddress, "{$InstallDir}", strInstallDir)
	DownAddress = Replace(DownAddress, "{$WebSiteUrl}", Newasp.SiteUrl)
	ShowOneAddress = DownAddress
End Function

Function ShowDownAddress(softid)
	Dim rsAddress, sqlAddress, rsDown
	Dim DownText,showdown
	Dim DownloadName, DownloadPath
	Dim DownAddress,selfont,ii,foundstr,n

	On Error Resume Next
	showdown = Newasp.ChkNumeric(Newasp.HtmlSetting(1))
	If PauseDown > 0 Then
		ShowDownAddress = Newasp.HtmlSetting(22)
		Exit Function
	End If
	If IsRandomAddress Then
		If IsSqlDataBase = 1 Then
			foundstr = " ORDER BY IsOuter DESC,newid()"
		Else
			foundstr = " ORDER BY IsOuter DESC,rnd(A.downid)"
		End If
	Else
		foundstr = " ORDER BY orders ASC"
	End If
	ii = 0
	n = 0
	Set rsDown = Newasp.Execute("SELECT id,downid,DownFileName,DownText FROM [NC_DownAddress] WHERE softid=" & CLng(softid))
	If Not (rsDown.BOF And rsDown.EOF) Then
		Do While Not rsDown.EOF
			ii = ii + 1
			DownText = rsDown("DownText") & ""
			If Len(DownText) = 0 Then DownText = "立即下载"
			If InStr(DownText, "{$") > 0 Then
				DownAddress = DownText
			Else
				'---- 如果使用了下载服务器,就打开下载服务器数据表
				If rsDown("downid") > 0 Then
					sqlAddress = "SELECT downid,DownloadName,DownloadPath,IsDisp,DownPoint,UserGroup,IsOuter,selfont FROM NC_DownServer WHERE ChannelID=" & ChannelID & " And depth=1 And rootid =" & rsDown("downid") & " And isLock=0 " & foundstr
					Set rsAddress = Newasp.Execute(sqlAddress)
					If rsAddress.EOF And rsAddress.BOF Then
						DownloadPath = ""
						DownloadName = ""
					Else
						Do While Not rsAddress.EOF
							DownAddress = DownAddress & Newasp.HtmlSetting(3)
							'---- 是否直接显示软件直接的下载地址
							If rsAddress("IsDisp") <> 1 Then
								DownloadPath = "download.asp?softid=" & softid & "&downid=" & rsAddress("downid") & "&id=" & rsDown(0)
							Else
								If rsAddress("IsOuter") <> 1 Then
									DownloadPath = Trim(rsAddress("DownloadPath") & rsDown(2))
								Else
									DownloadPath = Trim(rsAddress("DownloadPath"))
								End If
							End If
							ShowDownUrl = DownloadPath
							selfont = rsAddress("selfont") & ""
							If InStr(DownText, "###") > 0 Then
								DownloadName = Replace(rsAddress("DownloadName"), "{$SoftName}", DownText)
								DownloadName = Replace(DownloadName, "{$Soft_Name}", DownText)
								DownloadName = Replace(DownloadName, "###", "")
								DownAddress = Replace(DownAddress, "{$Soft_Name}", DownText)
								DownAddress = Replace(DownAddress, "{$show}", 1)
								DownAddress = Replace(DownAddress, "{$Title}", DownText)
							Else
								DownloadName = rsAddress("DownloadName") & ""
								DownloadName = Replace(DownloadName, "{$Soft_Name}", "")
								DownAddress = Replace(DownAddress, "{$Soft_Name}", "")
								DownAddress = Replace(DownAddress, "{$show}", 0)
								DownAddress = Replace(DownAddress, "{$Title}", SoftName)
							End If
							If Len(selfont) > 8 Then
								DownloadName = "<span " & selfont & ">" & DownloadName & "</span>"
							End If
							If rsAddress("UserGroup") > 0 Then
								DownloadName = Replace(DownloadName, "{$DownPoint}", rsAddress("DownPoint"))
							Else
								DownloadName = Replace(DownloadName, "{$DownPoint}", 0)
							End If
							DownloadName = Replace(DownloadName, "{$DownText}", DownText)
							DownloadName = Replace(DownloadName, "{$SoftName}", SoftName)
							DownAddress = Replace(DownAddress, "{$ii}", ii)
							DownAddress = Replace(DownAddress, "{$downid}", rsAddress("downid"))
							DownAddress = Replace(DownAddress, "{$DownLoadUrl}", DownloadPath)
							DownAddress = Replace(DownAddress, "{$DownLoadName}", DownloadName)
							DownAddress = Replace(DownAddress, "{$Number}", n)
							DownAddress = Replace(DownAddress, "###", "")
							rsAddress.MoveNext
							ii = ii + 1
							n = n + 1
						Loop
					End If
					Set rsAddress = Nothing
				Else
					DownAddress = DownAddress & Newasp.HtmlSetting(3)
					If showdown > 0 Then
						DownloadPath = Trim(rsDown("DownFileName") & "")
					Else
						DownloadPath = "download.asp?softid=" & softid & "&downid=0&id=" & rsDown(0)
					End If
					ShowDownUrl = DownloadPath
					DownAddress = Replace(DownAddress, "{$ii}", ii)
					DownAddress = Replace(DownAddress, "{$downid}", 0)
					DownAddress = Replace(DownAddress, "{$Soft_Name}", "")
					DownAddress = Replace(DownAddress, "{$Title}", SoftName)
					DownAddress = Replace(DownAddress, "{$DownLoadUrl}", DownloadPath)
					DownAddress = Replace(DownAddress, "{$DownLoadName}", DownText)
					DownAddress = Replace(DownAddress, "{$Number}", n)
					DownAddress = Replace(DownAddress, "###", "")
					DownAddress = Replace(DownAddress, "{$show}", 2)
					n = n + 1
				End If
			End If
			rsDown.MoveNext
		Loop
	End If
	Set rsDown = Nothing
	DownAddress = Replace(DownAddress, "{$SoftName}", SoftName)
	DownAddress = Replace(DownAddress, "{$ChannelRootDir}", ChannelRootDir)
	DownAddress = Replace(DownAddress, "{$InstallDir}", strInstallDir)
	DownAddress = Replace(DownAddress, "{$WebSiteUrl}", Newasp.SiteUrl)
	ShowDownAddress = DownAddress
End Function
Function BackAndNextSoftware(softid)
	Dim m_strContent
	SQL = "SELECT TOP 1 softid,SoftName,SoftVer FROM NC_SoftList WHERE ChannelID=" & ChannelID & " And isAccept>0 And softid<" & softid & " ORDER BY softid DESC"
	Set Rs = Newasp.Execute(SQL)
	If Rs.BOF And Rs.EOF Then
		m_strContent = ""
	Else
		m_strContent = "<li>上一" & Newasp.ModuleName & ":"
		If IsURLRewrite Then
			m_strContent = m_strContent & "<a href=""dl" & Newasp.Supplemental(Rs("softid"),6) & ".html"">" & Trim(Rs("SoftName") & " " & Rs("SoftVer")) & "</a>"
		Else
			m_strContent = m_strContent & "<a href=""?softid=" & Rs("softid") & """>" & Trim(Rs("SoftName") & " " & Rs("SoftVer")) & "</a>"
		End If
		m_strContent = m_strContent & "</li>" & vbCrLf
	End If
	Set Rs = Nothing
	SQL = "SELECT TOP 1 softid,SoftName,SoftVer FROM NC_SoftList WHERE ChannelID=" & ChannelID & " And isAccept>0 And softid>" & softid & " ORDER BY softid ASC"
	Set Rs = Newasp.Execute(SQL)
	If Rs.BOF And Rs.EOF Then
		m_strContent = m_strContent
	Else
		m_strContent = m_strContent & "<li>下一" & Newasp.ModuleName & ":"
		If IsURLRewrite Then
			m_strContent = m_strContent & "<a href=""dl" & Newasp.Supplemental(Rs("softid"),6) & ".html"">" & Trim(Rs("SoftName") & " " & Rs("SoftVer")) & "</a>"
		Else
			m_strContent = m_strContent & "<a href=""?softid=" & Rs("softid") & """>" & Trim(Rs("SoftName") & " " & Rs("SoftVer")) & "</a>"
		End If
		m_strContent = m_strContent & "</li>" & vbCrLf
	End If
	Set Rs = Nothing
	BackAndNextSoftware = m_strContent
End Function
Set NewCloud = Nothing
CloseConn
%>