하루 게시물 작성제한 채택완료
</p>
<p>if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가;</p>
<p>//1일 등록 가능한 게시물 게시판별 제한</p>
<p>function ask_write_check($bo_table, array $board_list){</p>
<p> global $g5, $member,$w;</p>
<p> //하루에 작성 가능한 게시물 수</p>
<p> $write_count = 5;</p>
<p> </p>
<p> if($w == '' && in_array($bo_table, $board_list) && $member && strstr($_SERVER['PHP_SELF'], 'write.php')){</p>
<p> $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 . "' ";</p>
<p> $cnt = sql_fetch($sql);</p>
<p> </p>
<p> if($cnt['cnt'] >= $write_count){</p>
<p> alert("해당 게시판은 하루에 최대 {$write_count}개의 게시물만 작성 가능합니다.");</p>
<p> return;</p>
<p> }else{</p>
<p> return;</p>
<p> }</p>
<p> }</p>
<p>}</p>
<p>ask_write_check($bo_table, array('notice'));//</p>
<p>
하루에 최대작성 개수 설정소스인데
댓글까지도 체크되고있습니다
게시글은 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'));
답변에 대한 댓글 1개
댓글을 작성하려면 로그인이 필요합니다.
댓글도 wr_is_comment = 0 이고,
답글도 wr_comment_reply = 0 이어야 할것 같은데요...
</strong></p>
<p>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'));<code> </code></p>
<p><strong>
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인
wr_datetime >= curdate() ";
라고 하셔도 됩니다.