개발-PHP

[함수] 제로보드 댓글 스팸 동시 전체삭제

WEBKIKIS 2016. 3. 30. 21:04
반응형

[함수] 제로보드 댓글 스팸 동시 전체삭제


아직도 제로보드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

반응형