<?php
$ipCheck = false;
$compareIp = array();
$remote = $_SERVER[REMOTE_ADDR];
$remoteIp = explode(".", $remote);
$result = array('1.1.1.*','2.2.2.2');
foreach($result as $key) {
$ip = explode(".", $key);
if($key == "*" || $key == $remote) {
$ipCheck = true;
break;
}
for($i = 0;$i < count($ip);$i++) {
if($ip[$i] != $remoteIp[$i] && $ip[$i] != "*") {
continue;
} else {
$compareIp[$i] = true;
}
}
if(@$compareIp[0] && @$compareIp[1] && @$compareIp[2] && @$compareIp[3]) {
$ipCheck = true;
break;
}
}
if($ipCheck != true) {
echo "접속제한 IP입니다.";
exit;
}
?>