민망한 인기 검색어를 걸러내자. > 그누4 팁자료실

그누4 팁자료실

그누보드4와 관련된 팁을 여러분들과 함께 공유하세요.
나누면 즐거움이 커집니다.

민망한 인기 검색어를 걸러내자. 정보

민망한 인기 검색어를 걸러내자.

본문

인기검색어 : 누드, 거시기, 머시기, 빤쑤, ^^

위와 같이 매니아가 아니라면 보기에도 뻘쭘한 검색어를 그대로 둘수가 없습니다.
급하게 만들다보니 놓친 부분이 있을수 있습니다.
그래도 A/S는 절대 없습니다. ^^;

./lib/popular.lib.php

<?
if (!defined('_GNUBOARD_')) exit;

// 인기검색어 출력
// $skin_dir : 스킨 디렉토리
// $pop_cnt : 검색어 몇개
// $date_cnt : 몇일 동안
function popular($skin_dir='basic', $pop_cnt=7, $date_cnt=3)
{
    global $config, $g4;

    if (!$skin_dir) $skin_dir = 'basic';

    # 관리자 페이지 필터링 필드를 활용해서 민망한 검색어를 제외하자!
    $str_exit = explode(",", $config[cf_filter]);
    for ($i=0; $i<count($str_exit); $i++)
    {
    $str_item = $str_exit[$i];
    }

    $date_gap = date("Y-m-d", $g4[server_time] - ($date_cnt * 86400));
    $sql = " select pp_word, count(*) as cnt from $g4[popular_table]
              where pp_word <> '$str_item' and pp_date between '$date_gap' and '$g4[time_ymd]'
              group by pp_word
              order by cnt desc, pp_word
              limit 0, $pop_cnt ";
    $result = sql_query($sql);
    for ($i=0; $row=sql_fetch_array($result); $i++)
    {
        $list[$i] = $row;
        // 스크립트등의 실행금지
        $list[$i][pp_word] = get_text($list[$i][pp_word]);
    }

    ob_start();
    $popular_skin_path = "$g4[path]/skin/popular/$skin_dir";
    include_once ("$popular_skin_path/popular.skin.php");
    $content = ob_get_contents();
    ob_end_clean();

    return $content;
}
?>
추천
1

댓글 15개

위 소스에 다음 부분이 있습니다.

pp_word <> '$str_item' and

$sql = " select pp_word, count(*) as cnt from $g4[popular_table]
              where pp_word <> '$str_item' and pp_date between .......

위처럼 수정이 되어야 합니다.

아예 소스를 복사하셔서 그대로 덮어씌워서 저장을 해도 될것입니다.
감사합니다..

위에 내용을 복사 하여 다 붙여 넣기 하고 했는데도 관리자페이지에서 설정한 필터링글자들이
 
검색을 한뒤 보니가 필터링 글자가 나오네요..무엇이 문제 인지요..제가 무얼 잘못 한게 있는

지..ㅠ.ㅠ
전체 22 |RSS
그누4 팁자료실 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1402호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT