asp

位置:IT落伍者 >> asp >> 浏览文章

ASP隐藏下载地址及防盗代码


发布日期:2020年12月08日
 
ASP隐藏下载地址及防盗代码

以下为引用的内容
<% 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("下载地址")%>

上一篇:一个实用asp分页函数

下一篇:asp 删除图片与文件函数