n회 이상 글 썼을 경우 포인트 지급 하지 않기 매개 게시판마다 다드르게 하려면 어떻게 수정해야 하나요?

n회 이상 글 썼을 경우 포인트 지급 하지 않기 매개 게시판마다 다드르게 하려면 어떻게 수정해야 하나요?

QA

n회 이상 글 썼을 경우 포인트 지급 하지 않기 매개 게시판마다 다드르게 하려면 어떻게 수정해야 하나요?

본문

n회 이상 글 썼을 경우 포인트 지급 하지 않기 매개 게시판마다 다드르게 하려면 어떻게 수정해야 하나요?

게시판 관리에서 bo_1 사용해서 매개 게시판마다 다르게 하려합니다.

lib/common.lib.php 에서 아래처럼 하니 작동 되지 않습니다ㅏ.

 

// 포인트 부여
function insert_point($mb_id, $point, $content='', $rel_table='', $rel_id='', $rel_action='', $expire=0, $repeat=0)
{
    global $config;
    global $g5;
    global $is_admin;
    
    // 하루 게시글 지전한개수이상 넘게 쓸 경우는 더이상 포인트 지급 안함
    if ($rel_action=='쓰기'){
        $sql = " select count(*) as cnt from {$g5['point_table']} where mb_id = '$mb_id' and left(po_datetime,10) = '".G5_TIME_YMD."' and po_rel_action = '쓰기' ";
        $row = sql_fetch($sql);
        if ($row['cnt'] > $board['bo_1'])
        return + 1;
    }

    // 포인트 사용을 하지 않는다면 return
    if (!$config['cf_use_point']) { return 0; }

    // 포인트가 없다면 업데이트 할 필요 없음
    if ($point == 0) { return 0; }

    // 회원아이디가 없다면 업데이트 할 필요 없음
    if ($mb_id == '') { return 0; }
    $mb = sql_fetch(" select mb_id from {$g5['member_table']} where mb_id = '$mb_id' ");
    if (!$mb['mb_id']) { return 0; }

    // 회원포인트
    $mb_point = get_point_sum($mb_id);

    // 이미 등록된 내역이라면 건너뜀 - 반복기능 추가
    if (!$repeat && ($rel_table || $rel_id || $rel_action))
    {
        $sql = " select count(*) as cnt from {$g5['point_table']}
                  where mb_id = '$mb_id'
                    and po_rel_table = '$rel_table'
                    and po_rel_id = '$rel_id'
                    and po_rel_action = '$rel_action' ";
        $row = sql_fetch($sql);
        if ($row['cnt'])
            return -1;
    }

    // 포인트 건별 생성
    $po_expire_date = '9999-12-31';
    if($config['cf_point_term'] > 0) {
        if($expire > 0)
            $po_expire_date = date('Y-m-d', strtotime('+'.($expire - 1).' days', G5_SERVER_TIME));
        else
            $po_expire_date = date('Y-m-d', strtotime('+'.($config['cf_point_term'] - 1).' days', G5_SERVER_TIME));
    }

    $po_expired = 0;
    if($point < 0) {
        $po_expired = 1;
        $po_expire_date = G5_TIME_YMD;
    }
    $po_mb_point = $mb_point + $point;

    $sql = " insert into {$g5['point_table']}
                set mb_id = '$mb_id',
                    po_datetime = '".G5_TIME_YMDHIS."',
                    po_content = '".addslashes($content)."',
                    po_point = '$point',
                    po_use_point = '0',
                    po_mb_point = '$po_mb_point',
                    po_expired = '$po_expired',
                    po_expire_date = '$po_expire_date',
                    po_rel_table = '$rel_table',
                    po_rel_id = '$rel_id',
                    po_rel_action = '$rel_action' ";
    sql_query($sql);

    // 포인트를 사용한 경우 포인트 내역에 사용금액 기록
    if($point < 0) {
        insert_use_point($mb_id, $point);
    }

    // 포인트 UPDATE
    $sql = " update {$g5['member_table']} set mb_point = '$po_mb_point' where mb_id = '$mb_id' ";
    sql_query($sql);
    
    // XP UPDATE
    update_xp($mb_id, $point, $content, $rel_table, $rel_action);

    return 1;
}

이 질문에 댓글 쓰기 :

답변 1

write_update.php 에 처리하는 것도 좀 쉬운 방법이 되겠네요..

게시판에서 회원이 작성한 글을 의 카운터를 뽑아서 비교

if(~~~~) {

insert_point ();

}

답변을 작성하시기 전에 로그인 해주세요.
전체 10,628
QA 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1404호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT