민망한 인기 검색어를 걸러내자.
인기검색어 : 누드, 거시기, 머시기, 빤쑤, ^^
위와 같이 매니아가 아니라면 보기에도 뻘쭘한 검색어를 그대로 둘수가 없습니다.
급하게 만들다보니 놓친 부분이 있을수 있습니다.
그래도 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;
}
?>
위와 같이 매니아가 아니라면 보기에도 뻘쭘한 검색어를 그대로 둘수가 없습니다.
급하게 만들다보니 놓친 부분이 있을수 있습니다.
그래도 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;
}
?>
|
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기
댓글 15개
얼른 업어갑니다.
그나저나 여기에 코멘트 붙이면 `**매니아`로 취급받는건 아니겠죠?? ㅎㅎ
사실은 저도 가끔은 즐깁니다.
^^;
거시*기, 머*시기 이런것도 낼름 잡아 낼런지요?ㅎㅎ
^^;
찾고 있었는데..
^^
편하게 아래처럼 하시는게 더 나을것 같습니다.
./lib/popular.lib.php 에 덮어 씌워버리는게 편리할것 같습니다.
뭐가 잘몬된건지...
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 .......
위처럼 수정이 되어야 합니다.
아예 소스를 복사하셔서 그대로 덮어씌워서 저장을 해도 될것입니다.
예전부터 필터링 해볼려고 질문하고 찾아다니고 그랬는데 말이죠^^
좋은 정보 고맙습니다.
수고하세요!
도움이 되었다고 하시니 다행입니다.
^^
위에 내용을 복사 하여 다 붙여 넣기 하고 했는데도 관리자페이지에서 설정한 필터링글자들이
검색을 한뒤 보니가 필터링 글자가 나오네요..무엇이 문제 인지요..제가 무얼 잘못 한게 있는
지..ㅠ.ㅠ