diff --git a/bbs/email_certify.php b/bbs/email_certify.php index 2fc735b32..83465e706 100644 --- a/bbs/email_certify.php +++ b/bbs/email_certify.php @@ -1,6 +1,9 @@ >>>>>> 70d48e4d5a4ca634bda2ba7095a6207ec1ccf5a8 // 이 상수가 정의되지 않으면 각각의 개별 페이지는 별도로 실행될 수 없음 define('_GNUBOARD_', true); diff --git a/lib/common.lib.php b/lib/common.lib.php index 0b7ae7755..6f9ee2cbb 100644 --- a/lib/common.lib.php +++ b/lib/common.lib.php @@ -3449,6 +3449,27 @@ function get_real_client_ip(){ return preg_replace('/[^0-9.]/', '', $real_ip); } +function check_mail_bot($ip=''){ + + //아이피를 체크하여 메일 크롤링을 방지합니다. + $check_ips = array('211.249.40.'); + $bot_message = 'bot 으로 판단되어 중지합니다.'; + + if($ip){ + foreach( $check_ips as $c_ip ){ + if( preg_match('/^'.preg_quote($c_ip).'/', $ip) ) { + die($bot_message); + } + } + } + + // user agent를 체크하여 메일 크롤링을 방지합니다. + $user_agent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : ''; + if ($user_agent === 'Carbon' || strpos($user_agent, 'BingPreview') !== false || strpos($user_agent, 'Slackbot') !== false) { + die($bot_message); + } +} + function get_call_func_cache($func, $args=array()){ static $cache = array();