加入收藏 | 设为首页 | 会员中心 | 我要投稿 常州站长网 (https://www.0519zz.com/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > Asp教程 > 正文

asp隐藏下载地址和防盗代码

发布时间:2022-04-12 05:29:29 所属栏目:Asp教程 来源:互联网
导读:% 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.filee
<% 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 "该文件不存在或者已经删除."
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 "该文件不存在或者已经删除."
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 "该文件数据不完整或许已损坏."
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
%>  

(编辑:常州站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    热点阅读