로봇이 검색하는 검색어 막기

로봇이 검색하는 검색어 막기

QA

로봇이 검색하는 검색어 막기

답변 1

본문

$agent = strtolower($HTTP_SERVER_VARS["HTTP_USER_AGENT"]);
if(!preg_match("/bot|slurp/", $agent))
{
    // 인기검색어
    $sql = " insert into {$g5['popular_table']} set pp_word = '$word', pp_date = '".G5_TIME_YMD."', pp_ip = '{$_SERVER['REMOTE_ADDR']}' ";
    sql_query($sql, FALSE);
}

 

이걸 어디에 무엇이랑 바꿔 넣어야 하는건가요?

이 질문에 댓글 쓰기 :

답변 1


lib / common.lib.php 3023라인 쯤
insert_popular() 함수를 아래처럼 바꿔 보세요.
// 인기검색어 입력
function insert_popular($field, $str)
{
    global $g5;
    $agent = strtolower($_SERVER['HTTP_USER_AGENT']);
    if(!in_array('mb_id', $field) && !preg_match("/bot|slurp/", $agent)){
        $sql = " insert into {$g5['popular_table']} set pp_word = '{$str}', pp_date = '".G5_TIME_YMD."', pp_ip = '{$_SERVER['REMOTE_ADDR']}' ";
        sql_query($sql, FALSE);
    }
}
답변을 작성하시기 전에 로그인 해주세요.
QA 내용 검색
질문등록
전체 0
© SIRSOFT
현재 페이지 제일 처음으로