#18530429 * SSO 및 페이지 리다이렉션에서 크롤러는 제외토록 수정

* 크롤러 판단 함수 추가
  * 믹시, 한RSS 포함 등

git-svn-id: http://xe-core.googlecode.com/svn/sandbox@7038 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
bnu 2009-12-14 06:59:20 +00:00
parent f3996d9f58
commit ddd38183de
3 changed files with 24 additions and 2 deletions

View file

@ -835,4 +835,26 @@
}
}
function isCrawler($agent = null) {
if(!$agent) $agent = $_SERVER['HTTP_USER_AGENT'];
$check_agent = array('bot', 'google', 'yahoo', 'daum', 'fish', 'hanrss');
$check_ip = array(
'211.245.21.11*' /* mixsh */
);
foreach($check_agent as $str) {
if(stristr($agent, $str) != FALSE) return true;
}
$check_ip = '/^('.implode($check_ip, '|').')/';
$check_ip = str_replace('.', '\.', $check_ip);
$check_ip = str_replace('*', '.+', $check_ip);
$check_ip = str_replace('?', '.?', $check_ip);
if(preg_match($check_ip, $_SERVER['REMOTE_ADDR'], $matches)) return true;
return false;
}
?>