`

让 "图片防盗链" 见鬼去吧

阅读更多

今天 在这里看到 搞定百度图片防盗链

 

百度的图片和很多网站防盗链措施一样,是基于Referer 判断
1. 如果浏览器发送的Referer 中不是从百度的域过来的,则判断为盗链
2. 如果浏览器没有发送Referer 头,则认为是不是 盗链

 

原来如此简单啊,这里进行了 百度 百度知道 和 javaeye 的测试 , 结果全部通过:

 

代码 如下:

 

<script>
window.sc=[];
//window.sc['if-sc1'] = "<img src='http://hiphotos.baidu.com/54nop/pic/item/939407fb49f406266c22eb5e.jpg?"+Math.random()+"'>";
window.sc['if-sc2'] = "<img src='http://tb.himg.baidu.com/sys/portrait/item/5a8a7a616b74313232343837dc02?"+Math.random()+"'>";
window.sc['if-sc3'] = "<img src='http://www.iteye.com/upload/logo/user/35330/4e311ac1-0916-340c-83bf-e343e6f44427-thumb.jpg?"+Math.random()+"'>";
</script>

<!--
图片 太大 不好截图 
<iframe id='if-sc1' src="javascript:parent.sc['if-sc1']" onload="javascript:var x=document.getElementById('if-sc1').contentWindow.document.images[0];
this.width=x.width+10;this.height=x.height+10;" style="border:0px;overflow:hidden;" 
scrolling="no" frameborder="0" ></iframe>
 -->
<br/>

<iframe id='if-sc2' src="javascript:parent.sc['if-sc2']" onload="javascript:var x=document.getElementById('if-sc2').contentWindow.document.images[0];
this.width=x.width+10;this.height=x.height+10;" style="border:0px;overflow:hidden;" 
scrolling="no" frameborder="0" ></iframe>

<br/>

<iframe id='if-sc3' src="javascript:parent.sc['if-sc3']" onload="javascript:var x=document.getElementById('if-sc3').contentWindow.document.images[0];
this.width=x.width+10;this.height=x.height+10;" style="border:0px;overflow:hidden;" 
scrolling="no" frameborder="0" ></iframe>


<hr/>

<?php
echo("<img src='http://hiphotos.baidu.com/54nop/pic/item/939407fb49f406266c22eb5e.jpg'/>");
echo("<img src='http://www.iteye.com/upload/logo/user/35330/4e311ac1-0916-340c-83bf-e343e6f44427-thumb.jpg'/>");
die("<img src='http://tb.himg.baidu.com/sys/portrait/item/5a8a7a616b74313232343837dc02'/>");

 

图示如下:

 

 

  • 大小: 43.7 KB
2
1
分享到:
评论
2 楼 yuhe 2013-07-07  
very good~
1 楼 vb2005xu 2010-10-19  
阻止checkbox的click冒泡

$('.checkbox').click(function(evt){
    // 阻止冒泡
    if (window.event) {  
        // Chrome,IE6,Opera
        window.event.cancelBubble = true;  
    } else {   
        // FireFox 3
        evt.stopPropagation();  
    } 
});

相关推荐

Global site tag (gtag.js) - Google Analytics