綠色資源網:您身邊最放心的安全下(xià)載站(zhàn)! 最新(xīn)軟件|熱(rè)門(mén)排行|軟件分(fèn)類|軟件專題|廠(chǎng)商大(dà)全

綠色資源網

技術教(jiāo)程
您的位置:首頁網絡(luò)編程Asp編程 → ASP隱(yǐn)藏(cáng)下載(zǎi)地址(zhǐ)及防盜代碼(mǎ)

ASP隱藏下載地址及防(fáng)盜代碼

我要(yào)評論 2010/02/07 12:48:33 來源:綠色(sè)資源網 編輯:綠色資(zī)源(yuán)站(zhàn) [ ] 評論:0 點擊:324次

以下為(wéi)引用的(de)內容:
<% FunctIon DownloadFIle(StrFIle)
StrFIlename=StrFIle
Response.Buffer=True
Response.Clear
Set S=Server.CreateObJect("ADODB.Stream")
S.Open
S.Type=1
on Error Resume Next
Set Fso=Server.CreateObJect("ScrIptIng.FIleSystemObJect")
If Not Fso.FIleExists(StrFIleName) Then
From_Url=Cstr(Request.ServerVarIables("HTTP_REFERER"))
Serv_Url=Cstr(Request.ServerVarIables("SERVER_NAME"))
If MId(From_Url,8,len(Serv_Url)) <> Serv_Url Then
Response.WrIte "該文(wén)件不(bú)存在或(huò)者已經刪除."
Response.End
End If
Response.RedIrect Request.ServerVarIables("HTTP_REFERER")
Response.End
End If
FileExt=MId(StrFIlename,InStrRev(StrFIleName, ".")+1)
Select Case UCase(FIleExt)
Case "ASP", "ASA", "ASPX", "ASAX", "MDB", "PHP", "JSP", "SHTML", "HTML", "HTM", "TV", "DATA"
From_Url=Cstr(Request.ServerVarIables("HTTP_REFERER"))
Serv_Url=Cstr(Request.ServerVarIables("SERVER_NAME"))
If MId(From_Url,8,len(Serv_Url)) <> Serv_Url Then
Response.WrIte "該文件不存在(zài)或者已經刪除."
Response.End
End If
Response.RedIrect Request.ServerVarIables("HTTP_REFERER")
Response.End
End Select
Set F=Fso.GetFIle(StrFIlename)
IntFIlelength=F.SIze
s.LoadFromFIle(StrFIlename)
If Err Then
From_Url=Cstr(Request.ServerVarIables("HTTP_REFERER"))
Serv_Url=Cstr(Request.ServerVarIables("SERVER_NAME"))
If MId(From_Url,8,len(Serv_Url)) <> Serv_Url Then
Response.WrIte "該文件數據(jù)不(bú)完(wán)整或(huò)許(xǔ)已損壞."
Response.End
End If
Response.RedIrect Request.ServerVarIables("HTTP_REFERER")
Response.End
End If
Set Upload=Server.CreateObJect("PersIts.Upload")
If Upload Is Nothing Then
Response.AddHeader "Content-DIsposItIon","attachment; FIlename="&F.Name
Response.AddHeader "Content-Length",IntFilelength
Response.CharSet="UTF-8"
Response.ContentType="application/x-download"
Response.BinaryWrite S.Read
Response.Flush
S.Close
Set s=NothIng
Else
Upload.SendBinary StrFIlename,True,"application/x-download",False
End If
End FunctIon
%>

調用

<%Call DownloadFIle("下載(zǎi)地址")%>

關鍵詞:ASP防盜(dào)代碼

閱讀本文後您有(yǒu)什麽(me)感想? 已有(yǒu) 人給出評價!

  • 0 歡迎喜歡
  • 0 白癡
  • 0 拜托(tuō)
  • 0 哇(wa)
  • 0 加油
  • 0 鄙視