하루 게시물 작성제한
본문
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'));
where 문에 wr_is_comment =0 을 추가해 주세요
wr_is_comment = 0 게시물
wr_is_comment = 1 댓글
답변을 작성하시기 전에 로그인 해주세요.