保存代码为,比如pic.asp
使用:http://www.xxx.com/pic.asp?url=http://www.aaaa.com/log.gif
不光是163,其实就是很多防盗连的图片都可以这个实现。
复制代码 代码如下:
<%
'盗链判断
'If Instr(Request.ServerVariables("http_referer"),"http://"&Request.ServerVariables("server_name")&"") = 0 Then
'Response.Write "非法链接"
'Response.End
'End If
Dim url, body, myCache
url = Request.QueryString("url")
Set myCache = new cache
myCache.name = "picindex"&url
If myCache.valid Then
body = myCache.value
Else
body = GetWebData(url)
myCache.add body,dateadd("d",1,now)
End If
If Err.Number = 0 Then
Response.CharSet = "UTF-8"
Response.ContentType = "application/octet-stream"
Response.BinaryWrite body
Response.Flush
Else
Wscript.Echo Err.Description
End if
'取得数据
Public Function GetWebData(ByVal strUrl)
Dim curlpath
curlpath = Mid(strUrl,1,Instr(8,strUrl,"/"))
Dim Retrieval
Set Retrieval = Server.CreateObject("Microsoft.XMLHTTP")
With Retrieval
.Open "Get", strUrl, False,"",""
.setRequestHeader "Referer", curlpath
.Send
GetWebData =.ResponseBody
End With
Set Retrieval = Nothing
End Function
'cache类
class Cache
private obj 'cache内容
private expireTime '过期时间
private expireTimeName '过期时间application名
private cacheName 'cache内容application名
private path 'url
private sub class_initialize()
path=request.servervariables("url")
path=left(path,instrRev(path,"/"))
end sub
private sub class_terminate()
end sub
public property get blEmpty
'是否为空
if isempty(obj) then
blEmpty=true
else
blEmpty=false
end if
end property
public property get valid
'是否可用(过期)
if isempty(obj) or not isDate(expireTime) then
valid=false
elseif CDate(expireTime)
else
valid=true
end if
end property
public property let name(str)
'设置cache名
cacheName=str & path
obj=application(cacheName)
expireTimeName=str & "expires" & path
expireTime=application(expireTimeName)
end property
public property let expires(tm)
'重设置过期时间
expireTime=tm
application.lock
application(expireTimeName)=expireTime
application.unlock
end property
public sub add(var,expire)
'赋值
if isempty(var) or not isDate(expire) then
exit sub
end if
obj=var
expireTime=expire
application.lock
application(cacheName)=obj
application(expireTimeName)=expireTime
application.unlock
end sub
public property get value
'取值
if isempty(obj) or not isDate(expireTime) then
value=null
elseif CDate(expireTime)
else
value=obj
end if
end property
public sub makeEmpty()
'释放application
application.lock
application(cacheName)=empty
application(expireTimeName)=empty
application.unlock
obj=empty
expireTime=empty
end sub
public function equal(var2)
'比较
if typename(obj)<>typename(var2) then
equal=false
elseif typename(obj)="Object" then
if obj is var2 then
equal=true
else
equal=false
end if
elseif typename(obj)="Variant()" then
if join(obj,"^")=join(var2,"^") then
equal=true
else
equal=false
end if
else
if obj=var2 then
equal=true
else
equal=false
end if
end if
end function
end class
%>
魔客吧温馨提示:如果你想搭建一个地方门户或者社交论坛,那么到魔客吧的 discuz模板 频道看看吧,这里有很多的地方门户和论坛模板哦!
分享到 更多 <script type="text/javascript" id="bdshell_js"></script><script type="text/javascript">document.getElementById("bdshell_js").src = "http://share.baidu.com/static/js/shell_v2.js?cdnversion=" + new Date().getHours();</script> 本文地址:http://www.moke8.com/article-19775-1.html文章标题:使用asp代码突破163相册的防盗连 收藏邀请 最新分享资源
响应式建筑建材水泥网站dede模板
dedecms模板 by moke响应式货运物流网站dedecms模板
dedecms模板 by moke生态农业酷站HTML模版
div+css模板 by hexipeng智能家居网站+手机端织梦模板
dedecms模板 by moke最新评论
相关分类
- PHP编程
- ASP编程
- NET编程
- JSP编程
- MSSQL教程
- MYSQL教程
精品推荐
精华 中英双语响应式电子企业织梦模板
dedecms模板 by moke极品资源
极品 高端建筑装饰带手机版十配色织梦模板
dedecms模板 by moke原创模板
魔币 多配色创意metro风格企业
下载排行
- 01响应式网站网络设计公司织梦
- 02响应式货运物流网站dedecms模
- 03智能家居网站+手机端织梦模板
- 04响应式建筑建材水泥网站dede
- 05生态农业酷站HTML模版
资源分类
企业网站模板 企业网站源码 个人网站模板 个人网页模板 手机wap网站 门户网站模板 商业源码 淘宝客程序 html5网站 网站后台模板 html网页模板 学校网站模板 <script type="text/javascript">var cookieLogin = Ajax("TEXT");cookieLogin.get("connect.php?mod=check&op=cookie", function() {});</script><script type="text/javascript">_attachEvent(window, 'load', getForbiddenFormula, document);function getForbiddenFormula() {var toGetForbiddenFormulaFIds = function () {ajaxget('plugin.php?id=cloudsearch&formhash=72da67c9');};var a = document.body.getElementsByTagName('a');for(var i = 0;i < a.length;i++){if(a[i].getAttribute('sc')) {a[i].setAttribute('mid', hash(a[i].href));a[i].onmousedown = function() {toGetForbiddenFormulaFIds();};}}var btn = document.body.getElementsByTagName('button');for(var i = 0;i < btn.length;i++){if(btn[i].getAttribute('sc')) {btn[i].setAttribute('mid', hash(btn[i].id));btn[i].onmousedown = function() {toGetForbiddenFormulaFIds();};}}}</script>联系我们 | 关于我们 | 招商加盟 | 版权声明 | 帮助中心 | 广告服务 | 网站地图
欢迎浏览魔客吧提供的 使用asp代码突破163相册的防盗连 信息,若本站中的信息侵犯了您的权益,请与本站管理员联系Copyright @ 2010-2015 魔客吧 版权所有 蜀ICP备09014119号 川公网安备51050202000165号 <script type="text/javascript" src="http://tcss.qq.com/ping.js?v=1VERHASH" charset="utf-8"></script><script type="text/javascript" reload="1">pgvMain({"discuzParams":{"r2":"5238379","ui":0,"rt":"portal","pn":1,"qq":"000"},"extraParams":""});</script>
积分 0, 距离下一级还需 积分 <script type="text/javascript">_attachEvent(window, 'scroll', function(){showTopLink();});</script><script>(function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https'){ bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else{ bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s);})();</script> <script type="text/javascript"> var tipsinfo = '5238379|X2.5|0.6||0||0|7|1505358019|977a12b9c816b754c317a7ea3e247159|2'; </script> <script src="http://discuz.gtimg.cn/cloud/scripts/discuz_tips.js?v=1" type="text/javascript" charset="UTF-8"></script>