function doGeoIP() { global $configArray; //Load GeoIP data require_once ROOT_DIR . '/sys/MaxMindGeoIP/geoip.inc'; require_once ROOT_DIR . '/sys/MaxMindGeoIP/geoipcity.inc'; $geoIP = geoip_open($configArray['Site']['local'] . '/../../sites/default/GeoIPCity.dat', GEOIP_MEMORY_CACHE); $geoRecord = GeoIP_record_by_addr($geoIP, $this->session->ip); if ($geoRecord) { $this->session->setCountry($geoRecord->country_code); $this->session->setState($geoRecord->region); $this->session->setCity($geoRecord->city); $this->session->latitude = $geoRecord->latitude; $this->session->longitude = $geoRecord->longitude; } geoip_close($geoIP); }