asp隐藏下载地址和防盗代码
发布时间:2022-01-08 17:35:05 所属栏目: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.fileexi
<% 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 %> (编辑:站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- .net core实用技巧——将EF Core生成的SQL语句显示在控制台
- 电热毛巾架销量之王 艾芬达双11再夺冠:连续4年蝉联品类销量
- 深港通股票名单一览表 深港通股票名单有那些
- 4424元人民币起 iPhone 6怎么预订 购买渠道介绍
- lol直播网站有哪些 lol直播网站哪些好
- 学会区分Visual Studio 2005,Visual Studio 2005 Team Syst
- 苹果开发者大会什么时候举办 wwdc2016什么时候举办
- 家具制造企业注意了!10月1日前未完成挥发性有机物整治将被
- 10.14 · 相约杭州 |第二届中国燃气具行业技术大会精彩前瞻
- 扬帆起航 智创未来 旷远e家项目发布会暨品牌战略签约仪式