使用asp代码突破图片的防盗连

编程入门 行业动态 更新时间:2024-10-11 05:20:15
从网上来的代码,,稍微修改了一些地方,其实用的是cache类。。 保存代码为,比如pic.asp 使用:www.51sjk/Upload/Articles/1/0/258/258005_20210630002644428.gif 不光是163,其实就是很多防盗连的图片都可以这个实现。 <% '盗链判断 'ifinstr(request.servervariables("http_referer"),""&request.servervariables("server_name")&"")=0then 'response.write"非法链接" 'response.end 'endif dimurl,body,mycache url=request.querystring("url") setmycache=newcache mycache.name="picindex"&url ifmycache.validthen body=mycache.value else body=getwebdata(url) mycache.addbody,dateadd("d",1,now) endif iferr.number=0then response.charset="utf-8" response.contenttype="application/octet-stream" response.binarywritebody response.flush else wscript.echoerr.description endif '取得数据 publicfunctiongetwebdata(byvalstrurl) dimcurlpath curlpath=mid(strurl,1,instr(8,strurl,"/")) dimretrieval setretrieval=server.createobject("microsoft.xmlhttp") withretrieval .open"get",strurl,false,"","" .setrequestheader"referer",curlpath .send getwebdata=.responsebody endwith setretrieval=nothing endfunction 'cache类 classcache privateobj'cache内容 privateexpiretime'过期时间 privateexpiretimename'过期时间application名 privatecachename'cache内容application名 privatepath'url privatesubclass_initialize() path=request.servervariables("url") path=left(path,instrrev(path,"/")) endsub privatesubclass_terminate() endsub publicpropertygetblempty '是否为空 ifisempty(obj)then blempty=true else blempty=false endif endproperty publicpropertygetvalid '是否可用(过期) ifisempty(obj)ornotisdate(expiretime)then valid=false elseifcdate(expiretime)<nowthen valid=false else valid=true endif endproperty publicpropertyletname(str) '设置cache名 cachename=str&path obj=application(cachename) expiretimename=str&"expires"&path expiretime=application(expiretimename) endproperty publicpropertyletexpires(tm) '重设置过期时间 expiretime=tm application.lock application(expiretimename)=expiretime application.unlock endproperty publicsubadd(var,expire) '赋值 ifisempty(var)ornotisdate(expire)then exitsub endif obj=var expiretime=expire application.lock application(cachename)=obj application(expiretimename)=expiretime application.unlock endsub publicpropertygetvalue '取值 ifisempty(obj)ornotisdate(expiretime)then value=null elseifcdate(expiretime)<nowthen value=null else value=obj endif endproperty publicsubmakeempty() '释放application application.lock application(cachename)=empty application(expiretimename)=empty application.unlock obj=empty expiretime=empty endsub publicfunctionequal(var2) '比较 iftypename(obj)<>typename(var2)then equal=false elseiftypename(obj)="object"then ifobjisvar2then equal=true else equal=false endif elseiftypename(obj)="variant()"then ifjoin(obj,"^")=join(var2,"^")then equal=true else equal=false endif else ifobj=var2then equal=true else equal=false endif endif endfunction endclass %>
  • 0
  • 0
  • 0
  • 0
  • 0

更多推荐

使用asp代码突破图片的防盗连

本文发布于:2023-06-11 00:11:34,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/621979.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:代码   图片   asp

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!