$sub_menu = "300400"; include_once('./_common.php'); auth_check($auth[$sub_menu], 'r'); if (empty($fr_date)) $fr_date = G4_TIME_YMD; if (empty($to_date)) $to_date = G4_TIME_YMD; $qstr = "fr_date={$fr_date}{&to_date}={$to_date}"; $sql_common = " from {$g4['popular_table']} a "; $sql_search = " where trim(pp_word) <> '' and pp_date between '{$fr_date}' and '{$to_date}' "; $sql_group = " group by pp_word "; $sql_order = " order by cnt desc "; $sql = " select pp_word {$sql_common} {$sql_search} {$sql_group} "; $result = sql_query($sql); $total_count = mysql_num_rows($result); $rows = $config['cf_page_rows']; $total_page = ceil($total_count / $rows); // 전체 페이지 계산 if ($page == '') { $page = 1; } // 페이지가 없으면 첫 페이지 (1 페이지) $from_record = ($page - 1) * $rows; // 시작 열을 구함 $sql = " select pp_word, count(*) as cnt {$sql_common} {$sql_search} {$sql_group} {$sql_order} limit {$from_record}, {$rows} "; $result = sql_query($sql); $listall = ''; if (!empty($_GET['fr_date']) || !empty($_GET['to_date'])) $listall = '전체목록'; $g4['title'] = '인기검색어순위'; include_once('./admin.head.php'); $colspan = 3; ?>