※ 그누보드5 기존 게시글 IP를 입력된 특정 아이피를 기준으로 삭제하거나 변경하는 메서드.
이 소스는 입력한 IP를 기준으로 저장된 IP를 모두 삭제하거나, 특정 IP를 다른 IP로 일괄 변경.
- ( 그누보드5 기준며, 기존 IP 정보를 삭제하거나 특정 IP로 일괄 변경 ) -
※ https://user-domain.com/delete_ip로 접속해 실행하는 방법
(your_project-DocumentRoot)/delete_ip/
├── index.php
└── ip_update.php
★ 데이터베이스(DB)에 접속하여 게시글의 IP 부분만 변경하거나 삭제하는 메서드임.
★ index.php - - - - - -
<?php
include_once './_common.php';
include_once(G5_ADMIN_PATH.'/admin.lib.php');
auth_check($auth['990530'], 'r');
if ($is_admin != 'super') {
alert('최고관리자만 접근.');
}
$g5['title'] = 'IP 삭제 및 변경';
include_once('../admin.head.php');
$pg_anchor = '<ul class="anchor">
<li><a href="#ip_delete">IP 삭제 및 변경</a></li>
</ul>';
$frm_submit = '<div class="btn_confirm01 btn_confirm">
<input type="submit" value="확인" class="btn_submit" accesskey="s">
<a href="'.G5_URL.'/">메인으로</a>
</div>';
?>
<div class="local_desc01 local_desc">
<p>기존 게시글의 IP를 삭제, 특정 IP를 원하는 IP로 변경.</p>
</div>
<form name="fconfigform" id="fconfigform" method="post" onsubmit="return fconfigform_submit(this);">
<section id="ip_delete">
<div class="tbl_frm01 tbl_wrap">
<table>
<caption>삭제 및 변경</caption>
<colgroup>
<col class="grid_4">
<col>
<col class="grid_4">
<col>
</colgroup>
<tbody>
<tr>
<th scope="row"><label for="previous_ip">기존 IP 주소</label></th>
<td><input type="text" name="previous_ip" id="previous_ip" class="frm_input" size="30"></td>
<th scope="row"><label for="new_ip">변경할 IP 주소</label></th>
<td><input type="text" name="new_ip" id="new_ip" class="frm_input" size="30"></td>
</tr>
</tbody>
</table>
</div>
</section>
<?php echo $frm_submit; ?>
</form>
<script>
function fconfigform_submit(f) {
if (!f.previous_ip.value && !f.new_ip.value) {
alert('IP 주소를 입력하거나 변경할 IP 주소 입력.');
return false;
}
f.action = "./ip_update.php";
return true;
}
</script>
<?php
include_once('../admin.tail.php');
?>
★ip_update.php - - - - - -
<?php
$sub_menu = "990530";
include_once('./_common.php');
auth_check($auth[$sub_menu], 'w');
if ($is_admin != 'super') {
alert('최고관리자만 접근 가능.');
}
$old_ip = $_POST['previous_ip'];
$new_ip = $_POST['new_ip'];
if (!$old_ip) {
alert('기존 IP 주소를 입력.');
}
if ($new_ip) {
$ip_update_query = "REPLACE(`wr_ip`, '{$old_ip}', '{$new_ip}')";
} else {
$ip_update_query = "''";
}
$sql = sql_query("SELECT * FROM {$g5['board_table']}");
while ($data = sql_fetch_array($sql)) {
sql_query("UPDATE {$g5['write_prefix']}{$data['bo_table']} SET wr_ip = {$ip_update_query}");
}
alert('IP 변경 및 삭제 작업이 완료.', './index.php');
?>
댓글목록
등록된 댓글이 없습니다.