[함수] 제로보드 댓글 스팸 동시 전체삭제
아직도 제로보드4를 사용하는데가 많아서 그냥 올려봅니다. 혹시라도 잘못된 부분이 있으면 지적 바랍니다.
제로보드 댓글뷰에 버튼을 관리자만 보이게 하고 클릭했을때 수없이 많이 올라오는 동일한 IP 에서 올라오는 글들을
모든 게시판에서 동시에 삭제 하는 방법입니다.
//게시판 아이디
$mb_id = array('board_id');
//사용법 if($is_admin) all_ip_del('211.145.12.3');
function all_ip_del($ip) {
global $mb_id;
$arr_id = $mb_id;
$arr_id = $mb_id;
for($i=0;$i $temp=mysql_query("select * from zetyx_board_comment_"."$arr_id[$i] where ip='$ip' ");
while($data=mysql_fetch_array($temp)) {
mysql_query("delete from zetyx_board_comment_"."$arr_id[$i] where ip='$ip' ");
$tmp_comment_cnt = mysql_fetch_array(mysql_query("select count(no) as cnt from zetyx_board_comment_"."$arr_id[$i] where parent='$data[parent]' "));
mysql_query("update zetyx_board_"."$arr_id[$i] SET total_comment = $tmp_comment_cnt['cnt'] where no='$data[parent]' ");
}
}
$avoid_ip = mysql_fetch_array(mysql_query("select avoid_ip from zetyx_admin_table "));
$avoid_ip_ = $avoid_ip['avoid_ip'].",$ip";
mysql_query("update zetyx_admin_table set avoid_ip='$avoid_ip_'");
--------
function all_ip_del($ip) {
global $mb_id;
$arr_id = $mb_id;
for($i=0;$i<count($arr_id);$i++) {
$temp=mysql_query("select * from zetyx_board_comment_"."$arr_id[$i] where ip='$ip' ");
while($data=mysql_fetch_array($temp)) {
mysql_query("delete from zetyx_board_comment_"."$arr_id[$i] where ip='$ip' ");
$tmp_comment_cnt = mysql_fetch_array(mysql_query("select count(no) as cnt from zetyx_board_comment_"."$arr_id[$i] where parent='$data[parent]' ");
mysql_query("update zetyx_board_"."$arr_id[$i] SET total_comment = $tmp_comment_cnt['cnt'] where no='$data[parent]' ");
}
}
$avoid_ip = mysql_fetch_array(mysql_query("select avoid_ip from zetyx_admin_table "));
$avoid_ip_ = $avoid_ip['avoid_ip'].",$ip";
mysql_query("update zetyx_admin_table set avoid_ip='$avoid_ip_'");
}
by phpschool
'개발-PHP' 카테고리의 다른 글
[함수] 왕 초보가 올리는 파일 업로드 방법 (0) | 2016.03.30 |
---|---|
[함수] array_iconv - 1~n차원 배열의 key, value 문자 인코딩 변환 함수 (0) | 2016.03.30 |
[함수] [함수 셀렉트박스] 만들기 처음으로 올림 ㅋ (0) | 2016.03.30 |
[함수] set_error_handler 함수 한계 극복하기 (0) | 2016.03.30 |
[함수] [수정]php 순환참조(RECURSION) 에 안전한 JSON, Array, Object 다루는 Tool 모음 (0) | 2016.03.30 |