봇의 메일 링크 크롤링 방지

This commit is contained in:
thisgun
2018-11-26 15:11:19 +09:00
parent 8399dafd4b
commit 918663a7e2
3 changed files with 27 additions and 0 deletions

View File

@ -1,6 +1,9 @@
<?php
include_once('./_common.php');
// 봇의 메일 링크 크롤링을 방지합니다.
if(function_exists('check_mail_bot')){ check_mail_bot($_SERVER['REMOTE_ADDR']); }
$mb_id = trim($_GET['mb_id']);
$mb_md5 = trim($_GET['mb_md5']);

View File

@ -1,6 +1,9 @@
<?php
include_once('./_common.php');
// 봇의 메일 링크 크롤링을 방지합니다.
if(function_exists('check_mail_bot')){ check_mail_bot($_SERVER['REMOTE_ADDR']); }
// 오류시 공히 Error 라고 처리하는 것은 회원정보가 있는지? 비밀번호가 틀린지? 를 알아보려는 해킹에 대비한것
$mb_no = trim($_GET['mb_no']);

View File

@ -3434,6 +3434,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();