PHP仿盗链代码

前端之家收集整理的这篇文章主要介绍了PHP仿盗链代码前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

<div class="codetitle"><a style="CURSOR: pointer" data="65090" class="copybut" id="copybut65090" onclick="doCopy('code65090')"> 代码如下:

<div class="codebody" id="code65090">
<?PHP
/*
@author seraphim
@copyright 2012
/
$ADMIN = array(
'defaulturl'=> 'http://www.xx.com/images/banner-header.gif',//盗链返回的地址
'url_1' => 'http://www.xx.net/file',
'url2' => 'http://www.xx.net/file1',
);
$okaysites = array(
'http://@R
301_460@.baidu.com',
'http://tieba.baidu.com/p/1493336008',//白名单
'http://www.xx.com/1.html',
);
$reffer = $_SERVER['HTTPREFERER'];
if ($reffer) {
$yes = 0;
while (list($domain,$subarray) = each($okaysites)) {
if (ereg($subarray,"$reffer")) {
$yes = 1;
}
}
$theu = 'url
' . $_GET['site'];
$file = $_GET['file'];
if ($ADMIN[$theu] and $yes == 1) {
header("Location: $ADMIN[$theu]/$file");
} else {
header("Location: $ADMIN[defaulturl]");
}
} else {
header("Location: $ADMIN[defaulturl]");
}
print_r($_SERVER['HTTP_REFERER']);
?>

原文链接:https://www.f2er.com/php/27173.html

猜你在找的PHP相关文章