You are here

function geoip_country_name_by_addr in GeoIP API 6

Same name and namespace in other branches
  1. 7 lib/geoip.inc \geoip_country_name_by_addr()

File

lib/geoip.inc, line 406

Code

function geoip_country_name_by_addr($gi, $addr) {
  if ($gi->databaseType == GEOIP_CITY_EDITION_REV1) {
    $record = geoip_record_by_addr($gi, $addr);
    return $record->country_name;
  }
  else {
    $country_id = geoip_country_id_by_addr($gi, $addr);
    if ($country_id !== false) {
      return $gi->GEOIP_COUNTRY_NAMES[$country_id];
    }
  }
  return false;
}