amin - 2012-09-17 00:43:05
hello there
i have searched for a ip range ban scripted and i have found this script
$userIP = ''; // User ip here either by $_SERVER['REMOTE_ADDR'] or with the getUserIP() function
$blockedAddresses = array('192.182.127.12', '255.0.0.0', '127.0.0.1', '192.*.*.*');
// Check every ip address
if(is_array($blockedAddresses) && count($blockedAddresses)) {
if(in_array($userIP, $blockedAddresses)) {
// this is for exact matches of IP address in array
header('Location: http://google.com');
exit();
} else {
// this is for wild card matches
foreach($blockedAddresses as $ip) {
if(preg_match('~'.$ip.'~', $userIP)) {
header('Location: http://google.com');
exit();
}
}
}
}
in this line
$blockedAddresses = array('192.182.127.12', '255.0.0.0', '127.0.0.1', '192.*.*.*');
if you put 7.*.*.*
every ip address that contains 7 will be blocked such as 127.0.0.1
is there anyone that knows about the bug?
with prior thanks