게시판별 아이피 차단하기[인트라넷 사용시]

· 18년 전 · 3266 · 1
전체 환경설정에서 아이피 차단하기를

====>> 각 게시판별 차단하기 설정입니다.


ㄱ. board_form.php 설정할곳에

<tr class='ht'>
<td></td>
<td>ip 환경설정</td>
<td>
<!-----ip 차단----------->
<table width=100% cellpadding=0 cellspacing=0 border=0>
<tr class='ht'>
<td valign=top>
접근가능 IP<br>
<textarea class=ed name='bo_7_subj' rows='5' style='width:99%;'><?=$board[bo_7_subj]?></textarea><br>입력된 IP의 컴퓨터만 접근할 수 있음.<br>123.123.* 도 입력 가능. (엔터로 구분)</td>
<td valign=top>
접근차단 IP<br>
<textarea class=ed name='bo_7' rows='5' style='width:99%;'><?=$board[bo_7]?></textarea><br>입력된 IP의 컴퓨터는 접근할 수 없음.<br>123.123.* 도 입력 가능. (엔터로 구분)</td>
</tr>
</table>
<!-----/ip 차단----------->
</td>
</tr>


ㄴ. view.php ...

////////ip차단 유무검사////////////////////


//목록보기는 허용하고 글 읽을경우 차단 유무확인


$is_admin = is_admin($member['mb_id']);
if ($is_admin != "super") {
// 접근가능 IP
$cf_possible_ip = trim($board['bo_7_subj']);
if ($cf_possible_ip) {
$is_possible_ip = false;
$pattern = explode("\n", $cf_possible_ip);
for ($i=0; $i<count($pattern); $i++) {
$pattern[$i] = trim($pattern[$i]);
if (empty($pattern[$i]))
continue;

$pat = "/({$pattern[$i]})/";
$is_possible_ip = preg_match($pat, $_SERVER['REMOTE_ADDR']);
if ($is_possible_ip)
break;
}
if (!$is_possible_ip)
die ("접근이 가능하지 않습니다.");
}

// 접근차단 IP
$is_intercept_ip = false;
$pattern = explode("\n", trim($board['bo_7']));
for ($i=0; $i<count($pattern); $i++) {
$pattern[$i] = trim($pattern[$i]);
if (empty($pattern[$i]))
continue;

$pat = "/({$pattern[$i]})/";
$is_intercept_ip = preg_match($pat, $_SERVER['REMOTE_ADDR']);
if ($is_intercept_ip)
alert("글 읽기 불가합니다", $g4[path]);
}
}



///////////////////////////////////////////
|

댓글 1개

초보라서 묻는데요
특정 ip차단시 어느곳에 ip를 써야 하나요.
댓글을 작성하시려면 로그인이 필요합니다. 로그인

그누4 팁자료실

그누보드4와 관련된 팁을 여러분들과 함께 공유하세요. 나누면 즐거움이 커집니다.

+
제목 글쓴이 날짜 조회
18년 전 조회 5,186
18년 전 조회 1만
18년 전 조회 3,242
18년 전 조회 7,186
18년 전 조회 1.1만
18년 전 조회 1만
18년 전 조회 2,790
18년 전 조회 3,637
18년 전 조회 4,119
18년 전 조회 3,267
18년 전 조회 2,567
18년 전 조회 5,102
18년 전 조회 2,479
18년 전 조회 3,359
18년 전 조회 2,907
18년 전 조회 5,607
18년 전 조회 3,907
18년 전 조회 3,484
18년 전 조회 4,335
18년 전 조회 2,982
🐛 버그신고