하루 글 등록 제한.

하루 글 등록 제한.

QA

하루 글 등록 제한.

본문

https://sir.kr/qa/380728?s_tag=%EA%B7%B8%EB%88%84%EB%B3%B4%EB%93%9C5

 

이 질문을 올렸었는데요. 

 

요약하자면 

 

//1일 등록 가능한 게시물 게시판별 제한
function ask_write_check($bo_table, array $board_list){
    global $g5, $member;
    //하루에 작성 가능한 게시물 수
    $write_count = 1;
    
    if(in_array($bo_table, $board_list) && $member && strstr($_SERVER['PHP_SELF'], 'write.php')){
        $sql = "select count(*) as cnt from {$g5['write_prefix']}{$bo_table} where mb_id = '{$member['mb_id']}' and date_format(wr_datetime, '%Y-%m-%d') >= '" . date('Y-m-d', time() - 86400 * 2) . "' ";
        $cnt = sql_fetch($sql);
        
        if($cnt['cnt'] >= $write_count){
            alert("사흘(3일)에 {$write_count}개의 게시물만 작성 가능합니다.");
            return;
        }else{
            return;
        }
    }
}
ask_write_check($bo_table, array('게시판1','게시판2'));//

 

이 소스인데.

 

테스트 해보니까 댓글도 게시글로 간주하더라구요 ㅠㅠ 

 

댓글 하나 달아도 게시글이 사용 안 되는데... 

 

게시글만 제한하려면 어떻게 수정하면 될까요?

이 질문에 댓글 쓰기 :

답변 1

 

 

 $sql = "select count(*) as cnt from {$g5['write_prefix']}{$bo_table} where mb_id = '{$member['mb_id']}'  and wr_is_comment = 0 and date_format(wr_datetime, '%Y-%m-%d') >= '" . date('Y-m-d', time() - 86400 

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

회원로그인

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