2017-01-06 5 views
0

차단하는 방법 (재) 경우 페이지가 .txt 파일에있는 경우 페이지를 일부 페이지를 차단하는 방법 :이 조각을 가지고.txt 파일에

- 좋은 소식이 block.txt의 URL입니다 .. 차단 (흰색 사이트)하지만 난 그것을

<?php 
list($blockExist, $blockData) = array(false, null); 

if (is_string($blockData = @file_get_contents('/block.txt'))) { 
    $blockData = preg_replace('/\s+/', '', $blockData); 
} 

if (isset($_SERVER['REQUEST_URI'])) { 
    $httpLink = explode('?', $_SERVER['REQUEST_URI']); 
    $httpLink = $httpLink[0] == '/' ? null : $httpLink[0]; 
} 

if ($blockData != null && $httpLink != null && stripos("{$blockData}http://", "{$httpLink}http://") !== false) { 
    $blockExist = true; 
} 

if ($blockExist) { 
    require_once dirname(__FILE__) . '/file-not-found.php'; 
    exit; 
} 
?> 

답변

0

이 코드를 시도 /file-not-found.php을 리디렉션 할 것

//require_once dirname(__FILE__) . '/file-not-found.php'; 
header('Location: http://www.example.com/file-not-found.php'); 

감사