熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> .NET編程 >> 正文

ASP隱藏下載地址及防盜代碼

2013-11-13 10:45:35  來源: .NET編程 

  以下為引用的內容
<% FunctIon DownloadFIle(StrFIle)
StrFIlename=StrFIle
ResponseBuffer=True
ResponseClear
Set S=ServerCreateObJect("ADODBStream")
SOpen
SType=
on Error Resume Next
Set Fso=ServerCreateObJect("ScrIptIngFIleSystemObJect")
If Not FsoFIleExists(StrFIleName) Then
From_Url=Cstr(RequestServerVarIables("HTTP_REFERER"))
Serv_Url=Cstr(RequestServerVarIables("SERVER_NAME"))
If MId(From_Urllen(Serv_Url)) <> Serv_Url Then
ResponseWrIte "該文件不存在或者已經刪除"
ResponseEnd
End If
ResponseRedIrect RequestServerVarIables("HTTP_REFERER")
ResponseEnd
End If
FileExt=MId(StrFIlenameInStrRev(StrFIleName "")+)
Select Case UCase(FIleExt)
Case "ASP" "ASA" "ASPX" "ASAX" "MDB" "PHP" "JSP" "SHTML" "HTML" "HTM" "TV" "DATA"
From_Url=Cstr(RequestServerVarIables("HTTP_REFERER"))
Serv_Url=Cstr(RequestServerVarIables("SERVER_NAME"))
If MId(From_Urllen(Serv_Url)) <> Serv_Url Then
ResponseWrIte "該文件不存在或者已經刪除"
ResponseEnd
End If
ResponseRedIrect RequestServerVarIables("HTTP_REFERER")
ResponseEnd
End Select
Set F=FsoGetFIle(StrFIlename)
IntFIlelength=FSIze
sLoadFromFIle(StrFIlename)
If Err Then
From_Url=Cstr(RequestServerVarIables("HTTP_REFERER"))
Serv_Url=Cstr(RequestServerVarIables("SERVER_NAME"))
If MId(From_Urllen(Serv_Url)) <> Serv_Url Then
ResponseWrIte "該文件數據不完整或許已損壞"
ResponseEnd
End If
ResponseRedIrect RequestServerVarIables("HTTP_REFERER")
ResponseEnd
End If
Set Upload=ServerCreateObJect("PersItsUpload")
If Upload Is Nothing Then
ResponseAddHeader "ContentDIsposItIon""attachment; FIlename="&FName
ResponseAddHeader "ContentLength"IntFilelength
ResponseCharSet="UTF"
ResponseContentType="application/xdownload"
ResponseBinaryWrite SRead
ResponseFlush
SClose
Set s=NothIng
Else
UploadSendBinary StrFIlenameTrue"application/xdownload"False
End If
End FunctIon
%>

  
調用

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


From:http://tw.wingwit.com/Article/program/net/201311/14448.html
    推薦文章
    Copyright © 2005-2013 電腦知識網 Computer Knowledge   All rights reserved.