게시판별로 아이디당 24안에 쓸 수 있는 글 제한 정보
게시판별로 아이디당 24안에 쓸 수 있는 글 제한본문
비슷한 팁은 있던데
게시판 별로 해서 한 아이디당 몇개 이상은 못쓰는건 있더라구요
근데 이걸 좀 바꾸어서 24시간안에 몇개 이렇게 하고 싶은데
고수분들 부탁드립니다.
//특정게시판에 회원별로 글한개만 남기게 할경우(관리자는 통과하고 수정은 가능하게)
$table_name ="forum"; //적용할 게시판을 넣어주세요.
$bo_table_name ="".$g4[write_prefix]."".$table_name."";
//회원이면서 관리자는 통과하고 수정은 가능하게
if(($member[mb_id] && !$is_admin && $w != "u") && $bo_table == $table_name){
//코멘트 와 답글, 종류는 전부 제외한 본인의 원글 갯수를 모두 가져오자
$ab_board =mysql_fetch_array(mysql_query("select count(*) from $bo_table_name where wr_is_comment ='0' and wr_reply ='' and mb_id ='$member[mb_id]'"));
$rowmember =$ab_board[0];
//1개이상 존재한다면
if($rowmember > 0){
alert("$member[mb_name] 님은 이미 이게시판에 $rowmember 개의 \\n남기신 글이 있으므로 더이상 글쓰기를 하실수가 없습니다.");
}
게시판 별로 해서 한 아이디당 몇개 이상은 못쓰는건 있더라구요
근데 이걸 좀 바꾸어서 24시간안에 몇개 이렇게 하고 싶은데
고수분들 부탁드립니다.
//특정게시판에 회원별로 글한개만 남기게 할경우(관리자는 통과하고 수정은 가능하게)
$table_name ="forum"; //적용할 게시판을 넣어주세요.
$bo_table_name ="".$g4[write_prefix]."".$table_name."";
//회원이면서 관리자는 통과하고 수정은 가능하게
if(($member[mb_id] && !$is_admin && $w != "u") && $bo_table == $table_name){
//코멘트 와 답글, 종류는 전부 제외한 본인의 원글 갯수를 모두 가져오자
$ab_board =mysql_fetch_array(mysql_query("select count(*) from $bo_table_name where wr_is_comment ='0' and wr_reply ='' and mb_id ='$member[mb_id]'"));
$rowmember =$ab_board[0];
//1개이상 존재한다면
if($rowmember > 0){
alert("$member[mb_name] 님은 이미 이게시판에 $rowmember 개의 \\n남기신 글이 있으므로 더이상 글쓰기를 하실수가 없습니다.");
}
댓글 전체

회원이 쓴 글의 개수를 가져오는 쿼리를 수정하면 되겠네요.
변경 전:
$ab_board =mysql_fetch_array(mysql_query("select count(*) from $bo_table_name where wr_is_comment ='0' and wr_reply ='' and mb_id ='$member[mb_id]'"));
변경 후:
$onedayago = date("Y-m-d", time() - 24*60*60);
$ab_board =mysql_fetch_array(mysql_query("select count(*) from $bo_table_name where wr_is_comment ='0' and wr_reply ='' and mb_id ='$member[mb_id]' and wr_datetime<'$onedayago'"));
그 아래에 "1개 이상 존재한다면" 부분의
if($rowmember > 0)
여기서 0을 적절한 숫자로 바꿔주면 되겠네요.
변경 전:
$ab_board =mysql_fetch_array(mysql_query("select count(*) from $bo_table_name where wr_is_comment ='0' and wr_reply ='' and mb_id ='$member[mb_id]'"));
변경 후:
$onedayago = date("Y-m-d", time() - 24*60*60);
$ab_board =mysql_fetch_array(mysql_query("select count(*) from $bo_table_name where wr_is_comment ='0' and wr_reply ='' and mb_id ='$member[mb_id]' and wr_datetime<'$onedayago'"));
그 아래에 "1개 이상 존재한다면" 부분의
if($rowmember > 0)
여기서 0을 적절한 숫자로 바꿔주면 되겠네요.
감사합니다! 바로 해볼게요