Copy Code code as follows:
<?php
/**
* @author Seraphim
* @copyright 2012
*/
$ADMIN = Array (
' Defaulturl ' => ' yun_qi_img/banner-header.gif ',//hotlinking return address
' Url_1 ' => ' http://www.xx.net/file ',
' Url_2 ' => ' http://www.xx.net/file1 ',
);
$okaysites = Array (
' Http://box.baidu.com ',
' http://tieba.baidu.com/p/1493336008 ',//whitelist
' Http://www.xx.com/1.html ',
);
$reffer = $_server[' Http_referer '];
if ($reffer) {
$yes = 0;
while (the 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 '));
?>