function _autoban_create_range in Automatic IP ban (Autoban) 7
Create IP range from single IP.
Parameters
string $hostname: IP address for ban.
Return value
string IP range string for insert to ban table.
1 call to _autoban_create_range()
- autoban_make_ip_style in ./
autoban.module - Make IP style for insert.
File
- ./
autoban.module, line 595 - Main file for autoban module.
Code
function _autoban_create_range($hostname) {
// Make range IP from aaa.bbb.ccc.ddd to aaa.bbb.ccc.0 - aaa.bbb.ccc.255 .
$parts = explode('.', $hostname);
if (count($parts) == 4) {
$parts[3] = '0';
$ip_start = implode('.', $parts);
$parts[3] = '255';
$ip_end = implode('.', $parts);
return "{$ip_start} - {$ip_end}";
}
return NULL;
}