[제나플러스] 댓글 삭제시 댓글 작성자 아이피 기준 일괄 삭제하기 > 팁앤테크

본문 바로가기
사이트 내 전체검색

팁앤테크

[제나플러스] 댓글 삭제시 댓글 작성자 아이피 기준 일괄 삭제하기

페이지 정보

본문

본 팁은 댓글 작성자의 ip 기준으로, 해당 ip 로 등록되어 있는 댓글을 일괄 삭제할 때 사용합니다.

일괄 삭제의 범위는 해당 게시판내 전체 댓글 입니다.

보너스로 기본환경설정의 아이피 차단에 등록도 합니다.



/게시판스 킨/view_comment.skin.php 파일중 코멘트 수정,삭제 버튼 있는 곳에 아래 코드 추가

<? if ($is_admin) { ?><a href="javascript:deleteipComment('<?=$list[$i]['wr_ip']?>');">삭 제 및 작성자(ip) 차단</a><? } ?>



/게시판스킨/view.skin.php

<? if ($is_admin) { ?>
<form name="fdeletecomment" method="post" style="margin:0px;">
<input type="hidden" name="bo_table" value="<?=$bo_table?>" />
<input type="hidden" name="wr_id" value="<?=$wr_id?>" />
<input type="hidden" name="ip" value="<?=$view['wr_ip']?>" />
</form>

<script type="text/javascript">
function deleteipComment(wr_ip) {

    var f = document.fdeletecomment;

    f.ip.value = wr_ip;

    if (confirm("해당 IP의 댓글을 모두 삭제 하시겠습니까?")) {

        f.action = g4_path+"/"+g4_bbs+"/adm.delete_ip_comment.php";
        f.submit();

    }

}
</script>
<? } ?>



/bbs/adm.delete_ip_comment.php

<?
include_once("./_common.php");

// 데이터
$bo_table = $_POST['bo_table']; // 게시판

if (!$bo_table || !$ip) {

    alert("요청하신 서비스를 찾을 수 없습니다.\\n\\n확인하신 후 다시 이용하시기 바랍니다.");

}

if (!$is_admin) {

    alert("요청하신 서비스를 찾을 수 없습니다.\\n\\n확인하신 후 다시 이용하시기 바랍니다.");

}

// 테이블 선언
$tmp_write_table = $g4['write_prefix'].$bo_table;

// 아이피 기준 댓글만
$sql = " select * from $tmp_write_table where wr_ip = '$ip' and wr_is_comment = '1' order by wr_id desc ";
$result = sql_query($sql);
for ($i=0; $data=sql_fetch_array($result); $i++) {

    // 아이디
    $comment_id = $data['wr_id'];

    // 원본
    $parent = $data['wr_parent'];

    // 회원 글
    if ($data['mb_id']) {

        // 코멘트 삭제
        if (!delete_point($data['mb_id'], $bo_table, $comment_id, '코멘트')) {
       
            insert_point($data['mb_id'], $board['bo_comment_point'] * (-1), "$board[bo_subject] {$data[wr_parent]}-{$comment_id} 코멘트삭제");
       
        }

    }

    // 코멘트 숫자 감소
    sql_query(" update $g4[board_table] set bo_count_comment = bo_count_comment - 1 where bo_table = '$bo_table' ");
   
    // 새글 삭제
    sql_query(" delete from $g4[board_new_table] where bo_table = '$bo_table' and wr_id = '$comment_id' ");

    // 스토리 코멘트 숫자 감소
    //sql_query(" update $p4[story_table] set wr_comment = wr_comment - 1 where bo_table = '$bo_table' and wr_id = '$parent' ");

    // 원글의 코멘트 숫자를 감소
    sql_query(" update $tmp_write_table set wr_comment = wr_comment - 1, wr_last = '$data[wr_datetime]' where wr_id = '$parent' ");

    // 코멘트 삭제
    sql_query(" delete from $tmp_write_table where wr_id = '$comment_id' ");

}

$sql = " select count(*) as cnt from $g4[config_table] where (INSTR(cf_intercept_ip, '$ip')) ";
$chk = sql_fetch($sql);

if (!$chk['cnt']) {
   
    // 차단할 아이피
    $cf_intercept_ip = $config['cf_intercept_ip']."\n".$ip;
   
    // 아이피 차단
    sql_query(" update $g4[config_table] set cf_intercept_ip = '$cf_intercept_ip' ");

}

// 이동
goto_url("$g4[bbs_path]/board.php?bo_table=".$bo_table."&wr_id=".$wr_id."");
?>
추천0

댓글목록

등록된 댓글이 없습니다.

Total 285건 3 페이지
  • RSS
팁앤테크 목록
번호 제목 글쓴이 조회 추천 날짜
235 제로쪽지보내기 메일보내기 홈페이지 자기소개 아이디로 검색 전체게시물 12565 0 12-18
234 제로쪽지보내기 메일보내기 홈페이지 자기소개 아이디로 검색 전체게시물 12385 0 12-15
233 제로쪽지보내기 메일보내기 홈페이지 자기소개 아이디로 검색 전체게시물 12358 0 11-27
232 제로쪽지보내기 메일보내기 홈페이지 자기소개 아이디로 검색 전체게시물 11873 0 11-26
231 제로쪽지보내기 메일보내기 홈페이지 자기소개 아이디로 검색 전체게시물 12446 0 11-26
230 제로쪽지보내기 메일보내기 홈페이지 자기소개 아이디로 검색 전체게시물 13132 0 11-26
229 제로쪽지보내기 메일보내기 홈페이지 자기소개 아이디로 검색 전체게시물 12907 0 11-26
228 제로쪽지보내기 메일보내기 홈페이지 자기소개 아이디로 검색 전체게시물 11564 0 11-08
227 제로쪽지보내기 메일보내기 홈페이지 자기소개 아이디로 검색 전체게시물 15503 0 10-26
226 제로쪽지보내기 메일보내기 홈페이지 자기소개 아이디로 검색 전체게시물 13838 0 10-23
225 제로쪽지보내기 메일보내기 홈페이지 자기소개 아이디로 검색 전체게시물 11884 1 10-22
224 제로쪽지보내기 메일보내기 홈페이지 자기소개 아이디로 검색 전체게시물 11386 0 10-14
223 제로쪽지보내기 메일보내기 홈페이지 자기소개 아이디로 검색 전체게시물 12078 0 09-20
222 제로쪽지보내기 메일보내기 홈페이지 자기소개 아이디로 검색 전체게시물 12011 0 09-17
221 제로쪽지보내기 메일보내기 홈페이지 자기소개 아이디로 검색 전체게시물 12169 0 09-17
220 제로쪽지보내기 메일보내기 홈페이지 자기소개 아이디로 검색 전체게시물 12191 0 08-15
219 제로쪽지보내기 메일보내기 홈페이지 자기소개 아이디로 검색 전체게시물 11640 0 08-12
218 제로쪽지보내기 메일보내기 홈페이지 자기소개 아이디로 검색 전체게시물 12241 0 06-14
217 제로쪽지보내기 메일보내기 홈페이지 자기소개 아이디로 검색 전체게시물 13031 0 05-22
216 제로쪽지보내기 메일보내기 홈페이지 자기소개 아이디로 검색 전체게시물 11498 0 05-21
215 제로쪽지보내기 메일보내기 홈페이지 자기소개 아이디로 검색 전체게시물 10934 0 05-18
214 제로쪽지보내기 메일보내기 홈페이지 자기소개 아이디로 검색 전체게시물 12296 0 05-08
213 제로쪽지보내기 메일보내기 홈페이지 자기소개 아이디로 검색 전체게시물 17752 0 04-30
212 제로쪽지보내기 메일보내기 홈페이지 자기소개 아이디로 검색 전체게시물 13041 0 03-25
열람중 제로쪽지보내기 메일보내기 홈페이지 자기소개 아이디로 검색 전체게시물 13522 0 03-25

검색

회원로그인

회원가입

사이트 정보

株式会社YHPLUS / 대표 : ZERO
〒140-0011 東京都品川区東大井2-5-9-203
050-5539-7787
오픈카카오톡 (YHPLUS) :
https://open.kakao.com/o/slfDj15d

접속자집계

오늘
5,334
어제
4,618
최대
7,259
전체
1,240,882
Copyright (c) 株式会社YHPLUS. All rights reserved.