111 lines
3.6 KiB
PHP
111 lines
3.6 KiB
PHP
<?php
|
|
$sub_menu = "300400";
|
|
include_once('./_common.php');
|
|
include_once(G5_PLUGIN_PATH.'/jquery-ui/datepicker.php');
|
|
|
|
auth_check($auth[$sub_menu], 'r');
|
|
|
|
if (empty($fr_date)) $fr_date = G5_TIME_YMD;
|
|
if (empty($to_date)) $to_date = G5_TIME_YMD;
|
|
|
|
$qstr = "fr_date={$fr_date}{&to_date}={$to_date}";
|
|
|
|
$sql_common = " from {$g5['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 = '<a href="'.$_SERVER['PHP_SELF'].'">전체목록</a>';
|
|
|
|
$g5['title'] = '인기검색어순위';
|
|
include_once('./admin.head.php');
|
|
|
|
$colspan = 3;
|
|
?>
|
|
|
|
<script>
|
|
$(function(){
|
|
$("#fr_date, #to_date").datepicker({ changeMonth: true, changeYear: true, dateFormat: "yy-mm-dd", showButtonPanel: true, yearRange: "c-99:c+99", maxDate: "+0d" });
|
|
});
|
|
</script>
|
|
|
|
<form name="fsearch" id="fsearch" method="get">
|
|
<fieldset>
|
|
<legend>인기검색어 검색</legend>
|
|
<span>
|
|
<?php echo $listall ?>
|
|
건수 <?php echo number_format($total_count) ?>개
|
|
</span>
|
|
<label for="fr_date">기간설정</label>
|
|
<input type="text" name="fr_date" value="<?php echo $fr_date ?>" id="fr_date" title="구간시작일" class="frm_input" size="11" maxlength="10"> 부터
|
|
<input type="text" name="to_date" value="<?php echo $to_date ?>" id="to_date" title="구간종료일" class="frm_input" size="11" maxlength="10"> 까지
|
|
<input type="submit" class="btn_submit" value="검색">
|
|
</fieldset>
|
|
</form>
|
|
|
|
<section class="cbox">
|
|
<h2>인기검색어 순위 및 내역</h2>
|
|
<form name="fpopularrank" id="fpopularrank" method="post">
|
|
<input type="hidden" name="sst" value="<?php echo $sst ?>">
|
|
<input type="hidden" name="sod" value="<?php echo $sod ?>">
|
|
<input type="hidden" name="sfl" value="<?php echo $sfl ?>">
|
|
<input type="hidden" name="stx" value="<?php echo $stx ?>">
|
|
<input type="hidden" name="page" value="<?php echo $page ?>">
|
|
<input type="hidden" name="token" value="<?php echo $token ?>">
|
|
<table class="tbl_pop_list">
|
|
<thead>
|
|
<tr>
|
|
<th scope="col">순위</th>
|
|
<th scope="col">검색어</th>
|
|
<th scope="col">검색회수</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php
|
|
for ($i=0; $row=sql_fetch_array($result); $i++) {
|
|
|
|
$word = get_text($row['pp_word']);
|
|
$rank = ($i + 1 + ($rows * ($page - 1)));
|
|
|
|
?>
|
|
|
|
<tr>
|
|
<td class="td_num"><?php echo $rank ?></td>
|
|
<td><?php echo $word ?></td>
|
|
<td class="td_numbig"><?php echo $row['cnt'] ?></td>
|
|
</tr>
|
|
|
|
<?php
|
|
}
|
|
|
|
if ($i == 0)
|
|
echo '<tr><td colspan="'.$colspan.'" class="empty_table">자료가 없습니다.</td></tr>';
|
|
?>
|
|
</tbody>
|
|
</table>
|
|
|
|
</form>
|
|
</section>
|
|
|
|
<?php
|
|
echo get_paging(G5_IS_MOBILE ? $config['cf_mobile_pages'] : $config['cf_write_pages'], $page, $total_page, "{$_SERVER['PHP_SELF']}?$qstr&page=");
|
|
?>
|
|
|
|
<?php
|
|
include_once('./admin.tail.php');
|
|
?>
|