一段防盜連的PHP代碼
更新時間:2006年12月06日 00:00:00 作者:
$ADMIN[defaulturl] = http://www.163.com/404.htm; //盜鏈返回的地址
$okaysites = array("http://www.163.com/","http://163.com") ; //白名單
$ADMIN[url_1] = http://www.163.com/download/; //下載地點1
$ADMIN[url_2] = "";//下載地點2,以此類推
$reffer = $HTTP_REFERER;
if($reffer) {
$yes = 0;
while(list($domain, $subarray) = each($okaysites)) {
if (ereg($subarray,"$reffer")) {
$yes = 1;
}
}
$theu = "url"."_"."$site";
if ($ADMIN[$theu] AND $yes == 1) {
header("Location: $ADMIN[$theu]/$file");
} else {
header("Location: $ADMIN[defaulturl]");
}
} else {
header("Location: $ADMIN[defaulturl]");
}
?>
使用方法:將上述代碼保存為dao4.php,
比如測試用的validatecode.rar在站點http://163.com/download里面,
則用以下代碼表示下載連接.
文件名?site=1&file=文件
$okaysites = array("http://www.163.com/","http://163.com") ; //白名單
$ADMIN[url_1] = http://www.163.com/download/; //下載地點1
$ADMIN[url_2] = "";//下載地點2,以此類推
$reffer = $HTTP_REFERER;
if($reffer) {
$yes = 0;
while(list($domain, $subarray) = each($okaysites)) {
if (ereg($subarray,"$reffer")) {
$yes = 1;
}
}
$theu = "url"."_"."$site";
if ($ADMIN[$theu] AND $yes == 1) {
header("Location: $ADMIN[$theu]/$file");
} else {
header("Location: $ADMIN[defaulturl]");
}
} else {
header("Location: $ADMIN[defaulturl]");
}
?>
使用方法:將上述代碼保存為dao4.php,
比如測試用的validatecode.rar在站點http://163.com/download里面,
則用以下代碼表示下載連接.
文件名?site=1&file=文件
相關文章
PHP使用array_multisort對多個數(shù)組或多維數(shù)組進行排序
這篇文章主要介紹了PHP使用array_multisort對多個數(shù)組或多維數(shù)組進行排序,需要的朋友可以參考下2014-12-12
php中session_id()函數(shù)詳細介紹,會話id生成過程及session id長度
這篇文章主要介紹了php中session_id()函數(shù)詳細介紹,會話id生成過程及session id長度的相關資料,需要的朋友可以參考下2015-09-09

