一段防盜連的PHP代碼
更新時(shí)間: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/; //下載地點(diǎn)1
$ADMIN[url_2] = "";//下載地點(diǎn)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在站點(diǎn)http://163.com/download里面,
則用以下代碼表示下載連接.
文件名?site=1&file=文件
$okaysites = array("http://www.163.com/","http://163.com") ; //白名單
$ADMIN[url_1] = http://www.163.com/download/; //下載地點(diǎn)1
$ADMIN[url_2] = "";//下載地點(diǎn)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在站點(diǎn)http://163.com/download里面,
則用以下代碼表示下載連接.
文件名?site=1&file=文件
相關(guān)文章
ThinkPHP V2.2說明文檔沒有說明的那些事實(shí)例小結(jié)
這篇文章主要介紹了ThinkPHP V2.2說明文檔沒有說明的那些事,實(shí)例分析了ThinkPHP中常用的技巧,需要的朋友可以參考下2015-07-07
PHP使用array_multisort對(duì)多個(gè)數(shù)組或多維數(shù)組進(jìn)行排序
這篇文章主要介紹了PHP使用array_multisort對(duì)多個(gè)數(shù)組或多維數(shù)組進(jìn)行排序,需要的朋友可以參考下2014-12-12
php中session_id()函數(shù)詳細(xì)介紹,會(huì)話id生成過程及session id長度
這篇文章主要介紹了php中session_id()函數(shù)詳細(xì)介紹,會(huì)話id生成過程及session id長度的相關(guān)資料,需要的朋友可以參考下2015-09-09

