하루 게시물 작성제한

하루 게시물 작성제한

QA

하루 게시물 작성제한

본문


if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가;
//1일 등록 가능한 게시물 게시판별 제한
function ask_write_check($bo_table, array $board_list){
    global $g5, $member,$w;
    //하루에 작성 가능한 게시물 수
    $write_count = 5;
    
    if($w == '' && 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') = '" . G5_TIME_YMD . "' ";
        $cnt = sql_fetch($sql);
        
        if($cnt['cnt'] >= $write_count){
            alert("해당 게시판은 하루에 최대 {$write_count}개의 게시물만 작성 가능합니다.");
            return;
        }else{
            return;
        }
    }
}
ask_write_check($bo_table, array('notice'));//

하루에 최대작성 개수 설정소스인데

 

댓글까지도 체크되고있습니다

게시글은 3개인데 댓글2개 작성 시 하루5개초과가 나오네요 어느부분을 손봐야할까요.

 

이 질문에 댓글 쓰기 :

답변 4


if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가;
//1일 등록 가능한 게시물 게시판별 제한
function ask_write_check($bo_table, array $board_list){
    global $g5, $member,$w;
    //하루에 작성 가능한 게시물 수
    $write_count = 5;
    
    if($w == '' && 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 wr_is_comment = 0 and date_format(wr_datetime, '%Y-%m-%d') = '" . G5_TIME_YMD . "' ";
        $cnt = sql_fetch($sql);
        
        if($cnt['cnt'] >= $write_count){
            alert("해당 게시판은 하루에 최대 {$write_count}개의 게시물만 작성 가능합니다.");
            return;
        }else{
            return;
        }
    }
}
ask_write_check($bo_table, array('notice'));

댓글도 wr_is_comment = 0 이고,

답글도 wr_comment_reply = 0 이어야 할것 같은데요...

 

 


if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가;
//1일 등록 가능한 게시물 게시판별 제한
function ask_write_check($bo_table, array $board_list){
    global $g5, $member,$w;
    //하루에 작성 가능한 게시물 수
    $write_count = 5;
    
    if($w == '' && 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 wr_is_comment = 0 and wr_comment_reply = 0  and date_format(wr_datetime, '%Y-%m-%d') = '" . G5_TIME_YMD . "' ";
        $cnt = sql_fetch($sql);
        
        if($cnt['cnt'] >= $write_count){
            alert("해당 게시판은 하루에 최대 {$write_count}개의 게시물만 작성 가능합니다.");
            return;
        }else{
            return;
        }
    }
}
ask_write_check($bo_table, array('notice')); 

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

회원로그인

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