[PHP] php防盗链 →→→→→进入此内容的聊天室

来自 , 2019-05-26, 写在 PHP, 查看 166 次.
URL http://www.code666.cn/view/445e1050
  1. $ADMIN[defaulturl] = "http://yuncode.net/404.htm";//盗链返回的地址  
  2. $okaysites = array("http://yuncode.net/","http://www.yuncode.net"); //白名单  
  3. $ADMIN[url_1] = "http://yuncode.net/temp/download/";//下载地点1  
  4. $ADMIN[url_2] = "";//下载地点2,以此类推  
  5.  
  6. $reffer = $HTTP_REFERER;  
  7. if($reffer) {  
  8. $yes = 0;  
  9. while(list($domain, $subarray) = each($okaysites)) {  
  10. if (ereg($subarray,"$reffer")) {  
  11. $yes = 1;  
  12. }  
  13. }  
  14. $theu = "url"."_"."$site";  
  15. if ($ADMIN[$theu] AND $yes == 1) {  
  16. header("Location: $ADMIN[$theu]/$file");  
  17. } else {  
  18. header("Location: $ADMIN[defaulturl]");  
  19. }  
  20. } else {  
  21. header("Location: $ADMIN[defaulturl]");  
  22. }?>

回复 "php防盗链"

这儿你可以回复上面这条便签

captcha