링크 카운트 제한 해제해서 계속 늘리기

그누보드의 링크는 세션을 감지해서 ip 혹은 회원당 링크 클릭시 카운트 증가를 1회로 제한하고 있습니다.

 

/bbs/link.php 파일에서

 

[code]

// 세션을 채크하여 1번만 카운트
$ss_name = 'ss_link_'.$bo_table.'_'.$wr_id.'_'.$no;
if (empty($_SESSION[$ss_name]))
{
    $sql = " update {$g5['write_prefix']}{$bo_table} set wr_link{$no}_hit = wr_link{$no}_hit + 1 where wr_id = '{$wr_id}' ";
    sql_query($sql);

    set_session($ss_name, true);
}

[/code]

 

이 부분입니다.

 

1회 카운트 제한없이 링크 클릭시 계속 증가 시키고 싶으면

 

[code]

<?php
include_once('./_common.php');

$html_title = '링크';

if (isset($write['wr_subject']) && $write['wr_subject']) {
    $html_title .= ' > '.conv_subject($write['wr_subject'], 255);
}

$no = isset($_REQUEST['no']) ? preg_replace('/[^0-9]/i', '', $_REQUEST['no']) : '';

if (!($bo_table && $wr_id && $no))
    alert_close('값이 제대로 넘어오지 않았습니다.');

// SQL Injection 예방
$row = sql_fetch(" select count(*) as cnt from {$g5['write_prefix']}{$bo_table} ", FALSE);
if (!(isset($row['cnt']) && $row['cnt']))
    alert_close('존재하는 게시판이 아닙니다.');

if (!(isset($write['wr_link'.$no]) && $write['wr_link'.$no]))
    alert_close('링크가 없습니다.');

/*
// 세션을 채크하여 1번만 카운트
$ss_name = 'ss_link_'.$bo_table.'_'.$wr_id.'_'.$no;
if (empty($_SESSION[$ss_name]))
{
    $sql = " update {$g5['write_prefix']}{$bo_table} set wr_link{$no}_hit = wr_link{$no}_hit + 1 where wr_id = '{$wr_id}' ";
    sql_query($sql);

    set_session($ss_name, true);
}
*/

// 무조건 카운트 증가
$sql = " update {$g5['write_prefix']}{$bo_table} set wr_link{$no}_hit = wr_link{$no}_hit + 1 where wr_id = '{$wr_id}' ";
sql_query($sql);

goto_url(set_http($write['wr_link'.$no]));

[/code]

 

이렇게 기존 세션채크 부분을 주석처리하시고 무조건 카운트 증가 쿼리를 넣으시면됩니다.

 

|

댓글 3개

감사합니다 ^^

감사합니다

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

그누보드5 팁자료실

+
제목 글쓴이 날짜 조회
4개월 전 조회 485
4개월 전 조회 494
4개월 전 조회 622
4개월 전 조회 495
4개월 전 조회 500
5개월 전 조회 468
5개월 전 조회 678
5개월 전 조회 848
5개월 전 조회 941
5개월 전 조회 609
5개월 전 조회 763
5개월 전 조회 552
5개월 전 조회 663
5개월 전 조회 798
5개월 전 조회 579
5개월 전 조회 598
5개월 전 조회 638
5개월 전 조회 576
5개월 전 조회 765
5개월 전 조회 979
5개월 전 조회 721
5개월 전 조회 568
5개월 전 조회 807
5개월 전 조회 563
5개월 전 조회 643
5개월 전 조회 505
5개월 전 조회 506
6개월 전 조회 594
6개월 전 조회 521
6개월 전 조회 842