function geoip_country_code_by_addr in Smart IP 7.2
Same name and namespace in other branches
- 6.2 includes/geoip.inc \geoip_country_code_by_addr()
1 call to geoip_country_code_by_addr()
- smart_ip_get_location in ./
smart_ip.module - Get the geo location from the IP address
File
- includes/
geoip.inc, line 545
Code
function geoip_country_code_by_addr($gi, $addr) {
if ($gi->databaseType == GEOIP_CITY_EDITION_REV1) {
$record = geoip_record_by_addr($gi, $addr);
if ($record !== false) {
return $record->country_code;
}
}
else {
$country_id = geoip_country_id_by_addr($gi, $addr);
if ($country_id !== false) {
return $gi->GEOIP_COUNTRY_CODES[$country_id];
}
}
return false;
}