연속 코멘트 금지 기능 정보
연속 코멘트 금지 기능본문
어제 질문에서 넓은마인드님께서 도움을 주셔서
동일 아이디로 연속 코멘트 남기기 제한 기능을 구현했는데요.
마지막 코멘트를 남긴 사람이 본인의 코멘트를 수정할 경우에도
코멘트 쓰기로 인식이 되어서 수정이 불가하네요.
마지막 코멘트 작성자가 코멘트를 수정하려면 바로는 안 되고 삭제하고 다시 남겨야 하는데...
수정도 가능하도록 구현 가능할까요?
넓은 마인드님 도움글
------------
해당 스킨 폴더에
write_comment_update.head.skin.php 파일 추가하시고
이 파일안에서 처리하시면 됩니다.
list($commentid) = mysql_fetch_array(mysql_query("select mb_id from $write_table where wr_parent='$wr_id' and wr_comment != '' order by wr_id desc limit 0,1 "));
if($commentid == $member[mb_id]){
alert('연속 코멘트는 등록이 불가합니다.');
}
위와같이 가장 최근에 등록된 코멘트 를 하나 가지고 와서 해당 아이디와 등록자 아이디가 동일할시에
예외처리를 해주시면 되겠습니다.~
동일 아이디로 연속 코멘트 남기기 제한 기능을 구현했는데요.
마지막 코멘트를 남긴 사람이 본인의 코멘트를 수정할 경우에도
코멘트 쓰기로 인식이 되어서 수정이 불가하네요.
마지막 코멘트 작성자가 코멘트를 수정하려면 바로는 안 되고 삭제하고 다시 남겨야 하는데...
수정도 가능하도록 구현 가능할까요?
넓은 마인드님 도움글
------------
해당 스킨 폴더에
write_comment_update.head.skin.php 파일 추가하시고
이 파일안에서 처리하시면 됩니다.
list($commentid) = mysql_fetch_array(mysql_query("select mb_id from $write_table where wr_parent='$wr_id' and wr_comment != '' order by wr_id desc limit 0,1 "));
if($commentid == $member[mb_id]){
alert('연속 코멘트는 등록이 불가합니다.');
}
위와같이 가장 최근에 등록된 코멘트 를 하나 가지고 와서 해당 아이디와 등록자 아이디가 동일할시에
예외처리를 해주시면 되겠습니다.~
댓글 전체
if($wr_id != $member[mb_id]){
list($commentid) = mysql_fetch_array(mysql_query("select mb_id from $write_table where wr_parent='$wr_id' and wr_comment != '' order by wr_id desc limit 0,1 "));
if($commentid == $member[mb_id]){
alert('연속 코멘트는 등록이 불가합니다.');
}
}
요런식으로 덮어 버리면 되지않을까요?
list($commentid) = mysql_fetch_array(mysql_query("select mb_id from $write_table where wr_parent='$wr_id' and wr_comment != '' order by wr_id desc limit 0,1 "));
if($commentid == $member[mb_id]){
alert('연속 코멘트는 등록이 불가합니다.');
}
}
요런식으로 덮어 버리면 되지않을까요?
나다구님도 감사드려요.^^
if($w=="c"){ // 코멘트가 글쓰기 모드일때 실행
list($commentid) = mysql_fetch_array(mysql_query("select mb_id from $write_table where wr_parent='$wr_id' and wr_comment != '' order by wr_id desc limit 0,1 "));
if($commentid == $member[mb_id]){
alert('연속 코멘트는 등록이 불가합니다.');
}
}
예외처리를 시켜주시면 됩니다.
list($commentid) = mysql_fetch_array(mysql_query("select mb_id from $write_table where wr_parent='$wr_id' and wr_comment != '' order by wr_id desc limit 0,1 "));
if($commentid == $member[mb_id]){
alert('연속 코멘트는 등록이 불가합니다.');
}
}
예외처리를 시켜주시면 됩니다.
정답을 주셨네요. 오늘도 도움 주셔서 진심 감사드립니다.^^
덕분에 이렇게 적용했어요~
// 연속 코멘트 제한
if($w=="c" && !$is_admin){ // 코멘트가 글쓰기 모드일때 실행, 운영자 제외
list($commentid) = mysql_fetch_array(mysql_query("select mb_id from $write_table where wr_parent='$wr_id' and wr_comment != '' order by wr_id desc limit 0,1 "));
if($commentid == $member[mb_id]){
alert('연속 코멘트는 등록이 불가합니다.');
}
}
덕분에 이렇게 적용했어요~
// 연속 코멘트 제한
if($w=="c" && !$is_admin){ // 코멘트가 글쓰기 모드일때 실행, 운영자 제외
list($commentid) = mysql_fetch_array(mysql_query("select mb_id from $write_table where wr_parent='$wr_id' and wr_comment != '' order by wr_id desc limit 0,1 "));
if($commentid == $member[mb_id]){
alert('연속 코멘트는 등록이 불가합니다.');
}
}