function ip_ranges_boot in IP Ranges 7
Same name and namespace in other branches
- 7.2 ip_ranges.module \ip_ranges_boot()
Implements hook_boot().
Checks users ip first against the whitelist, then the blacklist if needed.
See also
File
- ./
ip_ranges.module, line 51
Code
function ip_ranges_boot() {
$whitelist = ip_ranges_get_ip_list('whitelist');
$current_ip = ip_address();
foreach ($whitelist as $ip) {
if (ip_ranges_check_ip($ip->ip, $current_ip)) {
$whitelisted = 1;
break;
}
}
if (!isset($whitelisted)) {
$blacklist = ip_ranges_get_ip_list('blacklist');
foreach ($blacklist as $ip) {
if (ip_ranges_check_ip($ip->ip, $current_ip)) {
ip_ranges_deny_access();
}
}
}
}