[asp生成静态文件下载]asp生成静态文件代码

更新时间:2015-06-08    来源:php常用代码    手机版     字体:

【www.bbyears.com--php常用代码】


<%
Dim Rs,SQL,HtmlContent
Dim ChannelRootDir,strInstallDir,strIndexName
Dim flashid,downid,showurl,ErrMsg
Dim strTitle,strAddress,addTime
Dim AllHits,Introduce,filesize
Dim HtmlFileUrl,HtmlFileName,strUrl
Newasp.ReadChannel(ChannelID)
ChannelRootDir = Newasp.InstallDir & Newasp.ChannelDir
strInstallDir = Newasp.InstallDir
strIndexName = "" & Newasp.ChannelName & ""
flashid = Newasp.ChkNumeric(Request.Querystring("id"))
If flashid = 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}", Newasp.InstallDir)
HtmlContent = Replace(HtmlContent, "{$ChannelID}", ChannelID)
HtmlContent = Replace(HtmlContent, "{$ModuleName}", Newasp.ModuleName)
HtmlContent = Replace(HtmlContent, "{$FlashIndex}", strIndexName)
HtmlContent = ReadClassMenu(HtmlContent)
HtmlContent = ReadClassMenubar(HtmlContent)
SQL = "SELECT A.flashid,A.title,A.Introduce,A.filesize,A.downid,A.showurl,A.addTime,A.AllHits,A.HtmlFileDate,A.DownAddress,C.HtmlFileDir FROM NC_FlashList A INNER JOIN [NC_Classify] C On A.ClassID=C.ClassID WHERE A.ChannelID="& ChannelID &" And A.isAccept > 0 And A.flashid=" & flashid
Set Rs = Newasp.Execute(SQL)
If Rs.EOF And Rs.BOF Then
 ErrMsg = ErrMsg & "对不起~!没有找到你想下载的软件。"
 Returnerr(ErrMsg)
 Set Rs = Nothing
 Response.End
Else
 strTitle = Rs("title")
 strAddress = Newasp.ChkNull(Rs("DownAddress"))
 showurl = Newasp.ChkNull(Rs("showurl"))
 addTime = Rs("addTime")
 AllHits = Rs("AllHits")
 downid = Rs("downid")
 Introduce = Ubbcode(Rs("Introduce"))
 If CLng(Rs("filesize")) > 0 Then
  filesize = NewCloud.Readfilesize(Rs("fileSize"))
 Else
  filesize = "未知大小"
 End If
 If CInt(Newasp.IsCreateHtml) <> 0 Then
  HtmlFileUrl = ChannelRootDir & Rs("HtmlFileDir") & Newasp.ShowDatePath(Rs("HtmlFileDate"), Newasp.HtmlPath)
  HtmlFileName = Newasp.ReadFileName(Rs("HtmlFileDate"), Rs("flashid"), Newasp.HtmlExtName, Newasp.HtmlPrefix, Newasp.HtmlForm, "")
  strUrl = HtmlFileUrl & HtmlFileName
 Else
  strUrl = ChannelRootDir & "show.asp?id="& Rs("flashid")
 End If
End If
Rs.Close:Set Rs = Nothing
HtmlContent = Replace(HtmlContent, "{$PageTitle}", strTitle)
HtmlContent = Replace(HtmlContent, "{$FlashTitle}", strTitle)
HtmlContent = Replace(HtmlContent, "{$strUrl}", strUrl)
HtmlContent = Replace(HtmlContent, "{$DateAndTime}", addTime)
HtmlContent = Replace(HtmlContent, "{$FleshSize}", filesize)
HtmlContent = Replace(HtmlContent, "{$AllHits}", AllHits)
HtmlContent = Replace(HtmlContent, "{$Introduce}", Introduce)
HtmlContent = Replace(HtmlContent, "{$ShowDownAddress}", ShowDownAddress())
HtmlContent = Replace(HtmlContent, "{$FlashTitle}", strTitle)
HtmlContent = Replace(HtmlContent, "{$FlashID}", flashid)
HtmlContent = Replace(HtmlContent, "{$flashid}", flashid)
HtmlContent = Replace(HtmlContent, "{$ChannelRootDir}", ChannelRootDir)
HtmlContent = Replace(HtmlContent, "{$SkinPath}", Newasp.SkinPath)
HtmlContent = Replace(HtmlContent, "{$InstallDir}", strInstallDir)
HtmlContent = Replace(HtmlContent, "{$ChannelID}", ChannelID)
Response.Write HtmlContent
Set NewCloud = Nothing
Public Function ShowDownAddress()
 On Error Resume Next
 
 Dim rsDown,strDownAddress
 Dim i,DownloadPath
 strDownAddress = ""
 If Len(showurl) > 3 Then
  strDownAddress = Newasp.HtmlSetting(3)
  strDownAddress = Replace(strDownAddress, "{$DownLoadName}", "点击立即下载")
  If CInt(Newasp.HtmlSetting(1)) > 0 Then
   strDownAddress = Replace(strDownAddress, "{$DownLoadUrl}", NewCloud.FormatShowUrl(showurl))
  Else
   strDownAddress = Replace(strDownAddress, "{$DownLoadUrl}", "downfile.asp?url=" & showurl)
  End If
 End If
 If Len(strAddress) > 3 Then
  Set rsDown = Newasp.Execute("SELECT downid,DownloadName,DownloadPath,IsDisp FROM NC_DownServer WHERE ChannelID=" & ChannelID & " And depth=1 And rootid =" & downid & " And isLock=0 ORDER BY orders ASC")
  If Not (rsDown.BOF And rsDown.EOF) Then
   i = 0
   Do While Not rsDown.EOF
    If rsDown("IsDisp") > 0 Then
     DownloadPath = rsDown("DownloadPath") & strAddress
    Else
     DownloadPath = "download.asp?id=" & flashid & "&downid=" & rsDown("downid")
    End If
    strDownAddress = strDownAddress & Newasp.HtmlSetting(3)
    strDownAddress = Replace(strDownAddress, "{$DownLoadUrl}", DownloadPath)
    strDownAddress = Replace(strDownAddress, "{$DownLoadName}", rsDown("DownloadName"))
   rsDown.MoveNext
   i = i + 1
   Loop
  Else
   strDownAddress = strDownAddress & Newasp.HtmlSetting(3)
   strDownAddress = Replace(strDownAddress, "{$DownLoadName}", "点击立即下载")
   If CInt(Newasp.HtmlSetting(1)) > 0 Then
    strDownAddress = Replace(strDownAddress, "{$DownLoadUrl}", strAddress)
   Else
    strDownAddress = Replace(strDownAddress, "{$DownLoadUrl}", "download.asp?id=" & flashid & "&downid=0")
   End If
  End If
  Set rsDown = Nothing
 End If
 ShowDownAddress = strDownAddress
End Function
CloseConn
%>

本文来源:http://www.bbyears.com/jiaocheng/15672.html

猜你感兴趣