방문자수를 조정하는 방법이 있을까요? > 그누4 질문답변

그누4 질문답변

그누보드4 관련 질문은 QA 로 이전됩니다. QA 그누보드4 바로가기
기존 게시물은 열람만 가능합니다.

방문자수를 조정하는 방법이 있을까요? 정보

방문자수를 조정하는 방법이 있을까요?

본문

http://sir.co.kr/bbs/board.php?bo_table=g4_qa&wr_id=176812&sca=&sfl=wr_subject&stx=%B9%E6%B9%AE%C0%DA&sop=and

여기 보시면 sTricky님께서
 page open에 반응하도록 조정하면 방문자수를 오릴수있다고 하던데요..
 page open은 어디서 조정하면 되는건지요..;;

아니면 다른 방법이 있는건지..;;

db에서 g4_config로 들어가서 방문자수를 조정해도 1분이 지나면 원래대로 돌아옵니다...;;
왜 원래대로 돌아오는지 생각해보면 sTricky님 말씀대로 ip에 반응하도록 돼 있으니 그런것이
아닌가 하는데요..
  • 복사

댓글 전체

bbs/visit_insert.inc.php

상단에 추가
$visit_count = rand(1,5); // 랜덤으로 카운터 증가.


15, 20줄 수정
 $sql = " insert $g4[visit_sum_table] ( vs_count, vs_date) values ( 1, '$g4[time_ymd]' ) ";
->
 $sql = " insert $g4[visit_sum_table] ( vs_count, vs_date) values ( $visit_count, '$g4[time_ymd]' ) ";

 $sql = " update $g4[visit_sum_table] set vs_count = vs_count + 1 where vs_date = '$g4[time_ymd]' ";
->
 $sql = " update $g4[visit_sum_table] set vs_count = vs_count + $visit_count where vs_date = '$g4[time_ymd]' ";
$visit_count = rand(1,5); // 랜덤으로 카운터 증가.
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
// 컴퓨터의 아이피와 쿠키에 저장된 아이피가 다르다면 테이블에 반영함
if (get_cookie('ck_visit_ip') != $_SERVER['REMOTE_ADDR']) {
    set_cookie('ck_visit_ip', $_SERVER['REMOTE_ADDR'], 86400); // 하루동안 저장

    $tmp_row = sql_fetch(" select max(vi_id) as max_vi_id from $g4[visit_table] ");
    $vi_id = $tmp_row[max_vi_id] + 1;

    $sql = " insert $g4[visit_table] ( vi_id, vi_ip, vi_date, vi_time, vi_referer, vi_agent ) values ( '$vi_id', '$_SERVER[REMOTE_ADDR]', '$g4[time_ymd]', '$g4[time_his]', '$_SERVER[HTTP_REFERER]', '$_SERVER[HTTP_USER_AGENT]' ) ";
    $result = sql_query($sql, FALSE);
    // 정상으로 INSERT 되었다면 방문자 합계에 반영
    if ($result) {
        $sql = " insert $g4[visit_sum_table] ( vs_count, vs_date) values ( $visit_count, '$g4[time_ymd]' ) ";
        $result = sql_query($sql, FALSE);
       
        // DUPLICATE 오류가 발생한다면 이미 날짜별 행이 생성되었으므로 UPDATE 실행
        if (!$result) {
            $sql = " update $g4[visit_sum_table] set vs_count = vs_count + $visit_count where vs_date = '$g4[time_ymd]' ";
            $result = sql_query($sql);
        }

        // INSERT, UPDATE 된건이 있다면 기본환경설정 테이블에 저장
        // 방문객 접속시마다 따로 쿼리를 하지 않기 위함 (엄청난 쿼리를 줄임 ^^)

        // 오늘
        $sql = " select vs_count as cnt from $g4[visit_sum_table] where vs_date = '$g4[time_ymd]' ";
        $row = sql_fetch($sql);
        $vi_today = $row[cnt];

        // 어제
        $sql = " select vs_count as cnt from $g4[visit_sum_table] where vs_date = DATE_SUB('$g4[time_ymd]', INTERVAL 1 DAY) ";
        $row = sql_fetch($sql);
        $vi_yesterday = $row[cnt];

        // 최대
        $sql = " select max(vs_count) as cnt from $g4[visit_sum_table] ";
        $row = sql_fetch($sql);
        $vi_max = $row[cnt];

        // 전체
        //$sql = " select count(*) as cnt from $g4[visit_table] ";
        $sql = " select sum(vs_count) as total from $g4[visit_sum_table] ";
        $row = sql_fetch($sql);
        $vi_sum = $row[total];

        $visit = "오늘:$vi_today,어제:$vi_yesterday,최대:$vi_max,전체:$vi_sum";

        // 기본설정 테이블에 방문자수를 기록한 후
        // 방문자수 테이블을 읽지 않고 출력한다.
        // 쿼리의 수를 상당부분 줄임
        sql_query(" update $g4[config_table] set cf_visit = '$visit' ");
    }
}
?>
이렇게 올렸더니 상단에 이런 에러가 떳습니다..;;
$visit_count = rand(1,5); // 랜덤으로 카운터 증가.
Warning: Cannot modify header information - headers already sent by (output started at /home/hosting_users/sblandss/www/bbs/visit_insert.inc.php:2) in /home/hosting_users/sblandss/www/head.sub.php on line 32

Warning: Cannot modify header information - headers already sent by (output started at /home/hosting_users/sblandss/www/bbs/visit_insert.inc.php:2) in /home/hosting_users/sblandss/www/head.sub.php on line 34

Warning: Cannot modify header information - headers already sent by (output started at /home/hosting_users/sblandss/www/bbs/visit_insert.inc.php:2) in /home/hosting_users/sblandss/www/head.sub.php on line 35

Warning: Cannot modify header information - headers already sent by (output started at /home/hosting_users/sblandss/www/bbs/visit_insert.inc.php:2) in /home/hosting_users/sblandss/www/head.sub.php on line 36

Warning: Cannot modify header information - headers already sent by (output started at /home/hosting_users/sblandss/www/bbs/visit_insert.inc.php:2) in /home/hosting_users/sblandss/www/head.sub.php on line 37

Warning: Cannot modify header information - headers already sent by (output started at /home/hosting_users/sblandss/www/bbs/visit_insert.inc.php:2) in /home/hosting_users/sblandss/www/head.sub.php on line 38
"상단에 추가 "라 함은
꺽쇠안에 넣는것을 의미합니다.
테스트 할거면 숫자를 왕창 올려서해보세요.

<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
//$visit_count = rand(1,5); // 랜덤으로 카운터 증가.
$visit_count = "1000"; // <------------------ 1000씩 올라갑니다.
.........

참고 : 같은 아이피로는 하루에 한번씩만 카운터가 올라갑니다.
다른 아이피로 접속후 테스트해보세요.
© SIRSOFT
현재 페이지 제일 처음으로