免费注册 查看新帖 |

Chinaunix

广告
  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1652 | 回复: 6
打印 上一主题 下一主题

PHP5盗链函数(referfile) [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2006-02-06 18:17 |只看该作者 |倒序浏览

  1. PHP5盗链函数(referfile)
  2. 作者:axgle

  3. 功能:任何以‘HTTP_REFERER’为主要特征的防盗链技术将通通失效,顷刻间便灰飞烟灭。

  4. <?php
  5. /**
  6. @title:PHP5盗链函数
  7. @author:axgle
  8. @filename:referer.php
  9. @contents:This is a demo that show referer made success
  10. */

  11. if($_GET['id']) {
  12.         echo $_SERVER['HTTP_REFERER'];
  13. } else {
  14.         echo referfile('http://localhost/referer.php?id=1','http://axgle.is.good/');
  15.        
  16. }

  17. function referfile($url,$refer='') {
  18.         $opt=array('http'=>array('header'=>"Referer:$refer"));
  19.         $context=stream_context_create($opt);
  20.         return file_get_contents($url,false,$context);
  21. }

  22. ?>
复制代码

论坛徽章:
1
荣誉会员
日期:2011-11-23 16:44:17
2 [报告]
发表于 2006-02-06 18:21 |只看该作者
为什么是php5呢?

论坛徽章:
0
3 [报告]
发表于 2006-02-06 18:36 |只看该作者
因为我喜欢PHP5~~~~

论坛徽章:
0
4 [报告]
发表于 2006-02-06 19:30 |只看该作者
f($_GET['id']) {
        echo $_SERVER['HTTP_REFERER'];
这句什么意思呢..怎么实现盗链呢

论坛徽章:
0
5 [报告]
发表于 2006-02-06 20:14 |只看该作者
正在学习ing,axgle能否详细解释下...
大家先给点掌声,好不好?!!!

论坛徽章:
0
6 [报告]
发表于 2006-02-06 21:02 |只看该作者
stream_context_create
(PHP 4 >= 4.3.0, PHP 5)

stream_context_create -- Create a streams context
Description
resource stream_context_create ( [array options] )


Creates and returns a stream context with any options supplied in options preset.

options must be an associative array of associative arrays in the format $arr['wrapper']['option'] = $value. It defaults to an empty array.

例子 1. Using stream_context_create()

<?php
$opts = array(
  'http'=>array(
    'method'=>"GET",
    'header'=>"Accept-language: en\r\n" .
              "Cookie: foo=bar\r\n"
  )
);

$context = stream_context_create($opts);

/* Sends an http request to www.example.com
   with additional headers shown above */
$fp = fopen('http://www.example.com', 'r', false, $context);
fpassthru($fp);
fclose($fp);
?>

论坛徽章:
0
7 [报告]
发表于 2006-02-07 09:14 |只看该作者
任何以‘HTTP_REFERER’为主要特征的防盗链技术将通通失效,顷刻间便灰飞烟灭。

哇塞,功能好强大,好NB
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP