function autoban_gethostbyaddr in Automatic IP ban (Autoban) 7
Integrate function getting Internet host by IP address.
Parameters
string $ip: IP address.
Return value
string Internet host.
2 calls to autoban_gethostbyaddr()
- autoban_test in ./
autoban.admin.inc - Menu callback. Test autoban rule page.
- autoban_whitelist_ip in ./
autoban.module - Is IP address in whitelist
File
- ./
autoban.module, line 1032 - Main file for autoban module.
Code
function autoban_gethostbyaddr($ip) {
$real_host = FALSE;
$stored_host =& drupal_static(__FUNCTION__);
if (isset($stored_host[$ip])) {
$real_host = $stored_host[$ip];
}
else {
$gethostbyaddr_function = variable_get('autoban_gethostbyaddr_function', 'gethostbyaddr');
$real_host_get = $gethostbyaddr_function($ip);
if ($real_host_get && $real_host_get != $ip) {
$stored_host[$ip] = $real_host_get;
$real_host = $real_host_get;
}
}
return $real_host;
}