popular_rank 질문입니다. 채택완료

이놈을 제 입맛에 맞게 수정하려는데요

수정은 대충 제 맘대로했는데 이놈을 실행하면 관리자 로그인을 하라고 나와요

일반인에게 그냥 보여주려면 어떻게 해야하나요?


수정한 내용

<?php

include_once('./_common.php');


if (empty($fr_date) || ! preg_match("/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$/", $fr_date) ) $fr_date = G5_TIME_YMD2;

if (empty($to_date) || ! preg_match("/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$/", $to_date) ) $to_date = G5_TIME_YMD;


$qstr = "fr_date={$fr_date}{&amp;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 = sql_num_rows($result);


$rows = $config['cf_page_rows'];

$total_page  = ceil($total_count / $rows);  // 전체 페이지 계산

if ($page < 1) { $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 = '<a href="'.$_SERVER['SCRIPT_NAME'].'" class="ov_listall">전체목록</a>';


include_once(G5_PLUGIN_PATH.'/jquery-ui/datepicker.php');



?>


<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>


<div class="local_ov01 local_ov">

    <?php echo $listall ?>

    건수 <?php echo number_format($total_count) ?>개

</div>


<!--<form name="fsearch" id="fsearch" class="local_sch02 local_sch" method="get">

<div class="sch_last">

    <strong>기간별검색</strong>

    <input type="text" name="fr_date" value="<?php echo $fr_date ?>" id="fr_date" class="frm_input" size="11" maxlength="10">

    <label for="fr_date" class="sound_only">시작일</label>

    ~

    <input type="text" name="to_date" value="<?php echo $to_date ?>" id="to_date" class="frm_input" size="11" maxlength="10">

    <label for="to_date" class="sound_only">종료일</label>

    <input type="submit" class="btn_submit" value="검색">

</div>

</form>-->


<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 ?>">


<div class="tbl_head01 tbl_wrap">

    <table>

    <caption><?php echo $g5['title']; ?> 목록</caption>

    <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>

</div>


</form>


<?php

echo get_paging(G5_IS_MOBILE ? $config['cf_mobile_pages'] : $config['cf_write_pages'], $page, $total_page, "{$_SERVER['SCRIPT_NAME']}?$qstr&amp;page=");

?>


<?php

include_once(G5_PATH.'/tail.sub.php');

?>


config.php에 다음 추가

define('G5_TIME_YMD2',date('Y-m-d', strtotime('-1 month', time()))); 

답변 1개

채택된 답변
+20 포인트

올려주신 코드상에서는 관리자 체크 부분은 없습니다

혹시나 해서 직접 올려주신 코드로 해봤는데 그런 메시지는 뜨지 않습니다

head 파일을 따로 쓰신다면 아마 거기에 설정되어 있을 가능성이 있겠네요

그리고 adm 폴더에 두셔도 안 되고요. 자세한 정보가 없어서 추측만 가능하네요

로그인 후 평가할 수 있습니다

댓글을 작성하려면 로그인이 필요합니다.

답변을 작성하려면 로그인이 필요합니다.

로그인
🐛 버그신고