하루 글 등록 제한. 채택완료
https://sir.kr/qa/380728?s_tag=%EA%B7%B8%EB%88%84%EB%B3%B4%EB%93%9C5">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
답변에 대한 댓글 1개
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인