function get_geodata($ip) { require _TRACK_LIB_PATH . "/maxmind/geoipregionvars.php"; // названия регионов if (defined('_PHP5_GEOIP_ENABLED') && _PHP5_GEOIP_ENABLED || function_exists('geoip_record_by_name')) { $geoinfo = geoip_record_by_name($ip); $ispname = geoip_isp_by_name($ip); $cur_city = $geoinfo['city']; $cur_region = $geoinfo['region']; $cur_country = $geoinfo['country_code']; } else { require _TRACK_LIB_PATH . "/maxmind/geoip.inc.php"; require _TRACK_LIB_PATH . "/maxmind/geoipcity.inc.php"; $gi = geoip_open(_TRACK_STATIC_PATH . "/maxmind/MaxmindCity.dat", GEOIP_STANDARD); $record = geoip_record_by_addr($gi, $ip); $ispname = geoip_org_by_addr($gi, $ip); geoip_close($gi); $cur_city = $record->city; $cur_region = $record->region; $cur_country = $record->country_code; // Resolve GeoIP extension conflict if (function_exists('geoip_country_code_by_name') && $cur_country == '') { $cur_country = geoip_country_code_by_name($ip); } } return array('country' => $cur_country, 'region' => $cur_region, 'state' => $GEOIP_REGION_NAME[$cur_country][$cur_region], 'city' => $cur_city, 'isp' => $ispname); }
function testgeoipdatabase($type, $flags, $msg, $numlookups) { $gi = geoip_open($this->dbfilename[$type], $flags); if ($gi == null) { print "error: " . $this->dbfilename[$type] . " does not exist\n"; return; } $t1 = $this->ftime(); $i4 = 0; for ($i2 = 0; $i2 < $numlookups; $i2++) { switch ($type) { case GEOIP_COUNTRY_DATABASE: geoip_country_code_by_addr($gi, $this->randomipaddress()); break; case GEOIP_REGION_DATABASE: geoip_region_by_addr($gi, $this->randomipaddress()); break; case GEOIP_CITY_DATABASE: GeoIP_record_by_addr($gi, $this->randomipaddress()); break; } } $t2 = $this->ftime(); $t3 = $t2 - $t1; print $msg . "\n"; print $numlookups . " lookups made in " . $t3 . " seconds \n"; geoip_close($gi); }
/** * Gets customer location data by ip * * @static * @param string $ip * @param array $config * @return array */ public static function getGeoIpLocation($ip, $config) { if ($config['is_city_db_type']) { include_once Mage::getBaseDir() . DS . 'lib' . DS . 'GeoIP' . DS . 'geoipcity.inc'; include_once Mage::getBaseDir() . DS . 'lib' . DS . 'GeoIP' . DS . 'geoipregionvars.php'; } else { include_once Mage::getBaseDir() . DS . 'lib' . DS . 'GeoIP' . DS . 'geoip.inc'; } $geoip = geoip_open($config['db_path'], GEOIP_STANDARD); $data = array('ip' => $ip); if ($config['is_city_db_type']) { $record = geoip_record_by_addr($geoip, $ip); if ($record) { $data['code'] = $record->country_code; $data['country'] = $record->country_name; $data['region'] = isset($GEOIP_REGION_NAME[$record->country_code][$record->region]) ? $GEOIP_REGION_NAME[$record->country_code][$record->region] : $record->region; $data['city'] = $record->city; $data['postal_code'] = $record->postal_code; } } else { $data['code'] = geoip_country_code_by_addr($geoip, $ip); $data['country'] = geoip_country_name_by_addr($geoip, $ip); } geoip_close($geoip); return $data; }
function plugin_geoip_flag($ip) { global $CONFIG; $ip = $ip[1]; $return = ''; if ($ip != '') { if ($CONFIG['plugin_geoip_scope'] == '1' && file_exists("./plugins/geoip/GeoLiteCity.dat")) { $gi = geoip_open('plugins/geoip/GeoLiteCity.dat', GEOIP_STANDARD); $record = geoip_record_by_addr($gi, $ip); if ($record->country_code != '' && file_exists('images/flags/' . strtolower($record->country_code) . '.png') == TRUE) { $return = '<img src="images/flags/' . strtolower($record->country_code) . '.png" border="0" width="16" height="11" alt="" title="' . geoip_country_name_by_addr($gi, $ip) . '" style="margin-left:1px;" />'; } if ($record->city != '') { $return .= $record->city; } geoip_close($gi); } else { $gi = geoip_open('plugins/geoip/GeoIP.dat', GEOIP_STANDARD); $country_code = geoip_country_code_by_addr($gi, $ip); if ($country_code != '' && file_exists('images/flags/' . strtolower($country_code) . '.png') == TRUE) { $return = '<img src="images/flags/' . strtolower($country_code) . '.png" border="0" width="16" height="11" alt="" title="' . geoip_country_name_by_addr($gi, $ip) . '" style="margin-left:1px;" />'; } geoip_close($gi); } } return array($return); }
public static function add() { include "geo/geoipcity.inc"; include "geo/geoipregionvars.php"; $gi = geoip_open(__DIR__ . "/geo/GeoLiteCity.dat", GEOIP_STANDARD); $record = geoip_record_by_addr($gi, $_SERVER['REMOTE_ADDR']); $ip = $_SERVER['REMOTE_ADDR']; //est-ce que cette ip est déjà venue aujourd'hui ? if (Visiteur::ipVisitedToday($ip)) { //mise à jour de sa dernière visite $db = getConnexionDB(); $requete = "UPDATE visiteur SET DATE = CURRENT_TIMESTAMP WHERE IP = :IP AND DATE(DATE) = CURDATE()"; $stmt = $db->prepare($requete); $stmt->bindParam(':IP', $ip, PDO::PARAM_STR, 16); $res = executePDOSQPWithDebug($stmt); return true; } else { //création de la ligne pour aujourd'hui $db = getConnexionDB(); $requete = "INSERT INTO visiteur (IP, DATE, code_postal, pays, region, ville) VALUES('" . $ip . "', CURRENT_TIMESTAMP, '" . $record->postal_code . "', '" . $record->country_name . "', '" . $GEOIP_REGION_NAME[$record->country_code][$record->region] . "', '" . $record->city . "')"; $stmt = $db->prepare($requete); $res = executePDOSQPWithDebug($stmt); return true; } geoip_close($gi); }
public function onPostDispatchIndexController(Enlight_Event_EventArgs $arguments) { $controller = $arguments->getSubject(); $view = $controller->View(); $view->addTemplateDir($this->Path() . 'Views/'); $shopLang = Shopware()->Front()->Request()->getCookie('shopLang'); // $ip = $_SERVER['REMOTE_ADDR']; $ip = '195.149.248.130'; //BG // $ip = '194.50.69.124'; //DE // $ip = '211.156.198.82'; //CN $gi = geoip_open(__DIR__ . '/GeoIp/db/GeoIP.dat', GEOIP_STANDARD); $countryCode = geoip_country_code_by_addr($gi, $ip); geoip_close($gi); if ($shopLang != strtolower($countryCode)) { $shopLang = strtolower($countryCode); Shopware()->Front()->Response()->setCookie('shopLang', $shopLang, 0); $builder = Shopware()->Container()->get('dbal_connection')->createQueryBuilder(); $shopId = $builder->select('scs.id')->from('s_core_locales', 'scl')->innerJoin('scl', 's_core_shops', 'scs', 'scl.id = scs.locale_id')->where('scl.locale LIKE ?')->setParameter(0, $shopLang . '%')->execute()->fetch(); if ($shopId) { $view->extendsTemplate('frontend/index/change_shop.tpl'); $view->assign(array('shopId' => $shopId['id'])); } } }
function GetCountry($bot_ip) { $GI = geoip_open('includes/GeoIP.dat', GEOIP_STANDARD); $bot_country = geoip_country_code_by_addr($GI, $bot_ip); geoip_close($GI); return $bot_country; }
function readM() { include 'geoip.inc'; $gi = geoip_open('resources/GeoIP.dat', GEOIP_STANDARD); $country_code = geoip_country_code_by_addr($gi, $_SERVER['REMOTE_ADDR']); //$this->data['country_code'] = $country_code; $country_name = geoip_country_name_by_addr($gi, $_SERVER['REMOTE_ADDR']); //$this->data['country_name'] = $country_name; // close the database geoip_close($gi); $visit = array('id' => NULL, 'negara' => $country_name, 'visit' => 'news'); $this->model_visit->add($visit); $id = $this->uri->segment(4); if ($id == "cpagenews") { $bh = $this->uri->segment(6); redirect('user/cpagenews/ubahBhs/' . $this->uri->segment(6)); } $data['title'] = "news"; $this->load->view('user/vheader', $data); $bhs = $this->session->userdata('EN'); $data['gambar'] = $this->model_gambar->getGmb(); $data['berit'] = $this->model_berita->getByMore($id); $data['pengunjung'] = $this->model_conter->counAll(); $data['news'] = $this->model_berita->getSlideNews($bhs); $this->load->view('user/vmenu'); $this->load->view('user/frontend/page/vreadmore', $data); $this->load->view('user/vfooter'); }
function index() { $ip = $_SERVER['REMOTE_ADDR']; $masuk = TRUE; $msk = TRUE; $mskC = TRUE; $today = date('Y-m-d'); include 'geoip.inc'; $gi = geoip_open('resources/GeoIP.dat', GEOIP_STANDARD); $country_code = geoip_country_code_by_addr($gi, $_SERVER['REMOTE_ADDR']); //$this->data['country_code'] = $country_code; $country_name = geoip_country_name_by_addr($gi, $_SERVER['REMOTE_ADDR']); //$this->data['country_name'] = $country_name; // close the database geoip_close($gi); $visit = array('id' => NULL, 'negara' => $country_name, 'visit' => 'gallery'); $this->model_visit->add($visit); $data['title'] = "gallery"; $bhs = $this->session->userdata('EN'); $data['pengunjung'] = $this->model_conter->counAll(); $data['galeri'] = $this->model_galery->getBahasa($bhs); $data['gambar'] = $this->model_gambar->getGmb(); $this->load->view('user/vheader', $data); $this->load->view('user/vmenu'); $this->load->view('user/frontend/page/vgallery'); $this->load->view('user/vfooter'); }
function get_country_code_by_city($ip) { $gi = geoip_open(APPPATH . "timezone/GeoLiteCity.dat", GEOIP_STANDARD); $record = geoip_record_by_addr($gi, $ip); geoip_close($gi); return $record->city; }
public function get_geo_code($ip_address) { require_once ROOT . "geoipcity.inc"; $gi = geoip_open(ROOT . "GeoLiteCity.dat", GEOIP_STANDARD); $record = geoip_record_by_addr($gi, $ip_address); geoip_close($gi); return array("country" => $record->country_code, "state" => $record->region, "city" => $record->city); }
function get_country() { include "application/helpers/geoip/files/geoip.inc"; $gi = geoip_open("application/helpers/geoip/files/GeoIP.dat", GEOIP_STANDARD); $country_code = geoip_country_code_by_addr($gi, $_SERVER['HTTP_X_REAL_IP']); geoip_close($gi); return $country_code; }
function geoip_get_details_by_host($host) { require_once 'geoipcity.php'; $geoip = geoip_open('./GeoLiteCity.dat', GEOIP_STANDARD); $details = GeoIP_record_by_addr($geoip, gethostbyname($host)); geoip_close($geoip); return $details; }
function country_from_ip($addr) { // Switch GEOIP_SHARED_MEMORY for better perfs // (or a thousand times better, GeoIP C library binding for PHP) $gi = geoip_open('data/GeoIP.dat', GEOIP_STANDARD); $country = geoip_country_code_by_addr($gi, $addr); geoip_close($gi); return $country; }
function __construct() { parent::Model(); $country_name = CI::library('session')->userdata('country_name'); if (strval(trim($country_name)) == '') { if (!defined('USER_COUNTRY_NAME')) { if (is_file(BASEPATH . 'libraries/maxmind/geoip.inc') == true) { include BASEPATH . 'libraries/maxmind/geoip.inc'; $handle = geoip_open(BASEPATH . "libraries/maxmind/GeoIP.dat", GEOIP_STANDARD); //var_Dump($_SERVER ["REMOTE_ADDR"]); if ($_SERVER["REMOTE_ADDR"] == '::1') { $ip = '77.70.8.202'; } else { $ip = $_SERVER["REMOTE_ADDR"]; } $the_user_coutry = geoip_country_code_by_addr($handle, $ip); $the_user_coutry_name = geoip_country_name_by_addr($handle, $ip); //var_dump( $the_user_coutry); define("USER_COUNTRY", $the_user_coutry); define("USER_COUNTRY_NAME", $the_user_coutry_name); geoip_close($handle); } else { //exit('need geo ip'); } } //var_dump(USER_COUNTRY); CI::library('session')->set_userdata('country_name', USER_COUNTRY_NAME); } //print(USER_COUNTRY); //print(USER_COUNTRY_NAME); $shop_currency = CI::library('session')->userdata('shop_currency'); $country_name = CI::library('session')->userdata('country_name'); if (strval($country_name) == '') { CI::library('session')->set_userdata('country_name', USER_COUNTRY_NAME); } $shop_currency = CI::library('session')->userdata('shop_currency'); //print $shop_currency; if (strval($shop_currency) == '') { switch (strtolower(USER_COUNTRY)) { case 'uk': $this->currencyChangeSessionData("GBP"); break; case 'us': case 'usa': $this->currencyChangeSessionData("USD"); break; default: $this->currencyChangeSessionData("EUR"); break; } } $shop_currency = CI::library('session')->userdata('shop_currency'); // print $shop_currency; }
public static function geoLocIp($ip, $MM_version) { global $dbconn; $pathToGIP = "/Applications/XAMPP/xamppfiles/htdocs/mywebapps/ixmaps.ca/git-ixmaps.ca/application/geoip"; /*GeoLiteCity*/ $d_GeoLiteCity = geoip_open($pathToGIP . "/dat/" . $MM_version . "/GeoLiteCity.dat", GEOIP_STANDARD); //$gi1 = geoip_open("dat/GeoLiteCity.dat",GEOIP_STANDARD); $record1 = geoip_record_by_addr($d_GeoLiteCity, $ip); return $record1; geoip_close($d_GeoLiteCity); }
private function log_search_criteria() { $gi = geoip_open($GLOBALS['maxmind_geoip_data_file'], GEOIP_STANDARD); $country = geoip_country_code_by_addr($gi, $_SERVER['REMOTE_ADDR']); geoip_close($gi); if (empty($country) || is_null($country)) { $country = '??'; } $query = "INSERT INTO search_log SET \n from_ip_address = '" . $_SERVER['REMOTE_ADDR'] . "', \n from_country = '" . $country . "', \n keywords = '" . sanitize($this->keywords) . "', \n filter_industry = " . $this->industry . ", \n filter_country_code = '" . $this->country_code . "', \n searched_on = NOW()"; $mysqli = Database::connect(); return $mysqli->execute($query); }
private function _baseData() { $result = array('shipping' => array('country_id' => null, 'city' => null, 'region_id' => null, 'postcode' => null), 'billing' => array('country_id' => null, 'city' => null, 'region_id' => null, 'postcode' => null), 'equal' => true); $customer = Mage::getSingleton('customer/session')->getCustomer(); $addresses = $customer->getAddresses(); if (!$customer || !$addresses) { $result['equal'] = true; if (Mage::getStoreConfig('checkoutsimplificado/geo_ip/country')) { $geoip = geoip_open(Mage::getBaseDir('lib') . DS . 'MaxMind/GeoIP/data/' . Mage::getStoreConfig('checkoutsimplificado/geo_ip/country_file'), GEOIP_STANDARD); $country_id = geoip_country_code_by_addr($geoip, Mage::helper('core/http')->getRemoteAddr()); $result['shipping']['country_id'] = $country_id; $result['billing']['country_id'] = $country_id; geoip_close($geoip); } if (Mage::getStoreConfig('checkoutsimplificado/geo_ip/city')) { $geoip = geoip_open(Mage::getBaseDir('lib') . DS . 'MaxMind/GeoIP/data/' . Mage::getStoreConfig('checkoutsimplificado/geo_ip/city_file'), GEOIP_STANDARD); $record = geoip_record_by_addr($geoip, Mage::helper('core/http')->getRemoteAddr()); $result['shipping']['city'] = $record->city; $result['billing']['city'] = $record->city; $result['shipping']['postcode'] = $record->postal_code; $result['billing']['postcode'] = $record->postal_code; geoip_close($geoip); } if (empty($result['shipping']['country_id'])) { $country_id = Mage::getStoreConfig('checkoutsimplificado/general/country'); $result['shipping']['country_id'] = $country_id; $result['billing']['country_id'] = $country_id; } } else { $bill_addr = $customer->getPrimaryBillingAddress(); if (!$bill_addr) { foreach ($addresses as $address) { $bill_addr = $address; break; } } $ship_addr = $customer->getPrimaryShippingAddress(); if (!$ship_addr) { foreach ($addresses as $address) { $ship_addr = $address; break; } } $result['shipping']['country_id'] = $ship_addr->getCountryId(); $result['billing']['country_id'] = $bill_addr->getCountryId(); $eq = false; if ($ship_addr->getId() === $bill_addr->getId()) { $eq = true; } $result['equal'] = $eq; } return $result; }
function convertip_geo($ip = '', $ipdatafile = '') { require_once DISCUZ_ROOT . './source/function/geoip.inc'; $gi = geoip_open($ipdatafile, GEOIP_STANDARD); $country = geoip_country_code_by_addr($gi, $ip); geoip_close($gi); if ($country) { return lang('country', $country); } else { return lang('country', '??'); } }
function getCountry($ip) { if (strpos($ip, ":") === false) { $gi = geoip_open($this->ipv4DatabasePath, GEOIP_STANDARD); $country = geoip_country_name_by_addr($gi, $ip); } else { $gi = geoip_open($this->ipv6DatabasePath, GEOIP_STANDARD); $country = geoip_country_name_by_addr_v6($gi, $ip); } geoip_close($gi); return $country; }
/** * Get Geo-Information for a specific IP * @param string $ip IP-Adress (currently only IPv4) * @return geoiprecord GeoInformation. (0 or NULL: no infos found.) */ function geoip_detect_get_info_from_ip($ip) { $data_file = geoip_detect_get_abs_db_filename(); if (!$data_file) { return 0; } $gi = geoip_open($data_file, GEOIP_STANDARD); $record = geoip_record_by_addr($gi, $ip); geoip_close($gi); $record = apply_filters('geoip_detect_record_information', $record, $ip); return $record; }
function index() { $ip = $_SERVER['REMOTE_ADDR']; $masuk = TRUE; $msk = TRUE; $mskC = TRUE; $today = date('Y-m-d'); include 'geoip.inc'; $gi = geoip_open('resources/GeoIP.dat', GEOIP_STANDARD); $country_code = geoip_country_code_by_addr($gi, $_SERVER['REMOTE_ADDR']); //$this->data['country_code'] = $country_code; $country_name = geoip_country_name_by_addr($gi, $_SERVER['REMOTE_ADDR']); //$this->data['country_name'] = $country_name; // close the database geoip_close($gi); $visit = array('id' => NULL, 'negara' => $country_name, 'visit' => 'home'); $this->model_visit->add($visit); foreach ($this->model_conter->getAll() as $r) { if ($ip == $r->ip && $today == $r->tanggal) { $masuk = FALSE; } } foreach ($this->model_conter->getAll2() as $r) { if ($today == $r->tanggal) { $msk = FALSE; } } foreach ($this->model_conter->getAllC() as $r) { if ($country_name == $r->negara) { $mskC = FALSE; } } $konter = array('total' => $this->model_conter->counN($country_name)); $this->model_conter->edit($konter, $country_name); if ($msk) { $konter2 = array('id' => NULL, 'tanggal' => $today); $this->model_conter->addR($konter2); } if ($mskC) { $ni = array('id' => NULL, 'negara' => $country_name, 'total' => 1); $this->model_conter->addC($ni); } if ($masuk) { $konter = array('idcounter' => NULL, 'tanggal' => $today, 'ip' => $ip, 'negara' => $country_name); $this->model_conter->add($konter); } $data['title'] = "home page"; $bhs = $this->session->userdata('EN'); $data['pengunjung'] = $this->model_conter->counAll(); $data['news'] = $this->model_berita->getSlideNews($bhs); $this->load->view('user/vcontent_rev', $data); }
function google_apis_fix($buffer) { $geoData = geoip_open(PLUGIN_PATH . 'geo/GeoIP.dat', GEOIP_STANDARD); $countryCode = geoip_country_code_by_addr($geoData, $_SERVER['REMOTE_ADDR']); geoip_close($geoData); if ($countryCode === 'CN' || $countryCode === '') { return preg_replace_callback('|(https*:)*//(.*).googleapis.com/|', function ($matches) { return 'http://' . $matches[2] . '.useso.com/'; }, $buffer); } else { return $buffer; } }
function main() { global $country, $ip, $currentTime; $currentTime = mktime(); $gi = geoip_open("geo/geoip/GeoIP.dat", GEOIP_STANDARD); $ip = $_SERVER["REMOTE_ADDR"]; $country = geoip_country_code_by_addr($gi, $ip); geoip_close($gi); setcookie("geo", $country, time() + 15552000, "/", $base . $domain, 0); //6 month cookie connect(); displayClientWebSite($ip, $country, $currentTime); }
/** * {@inheritDoc} */ public function getGeocodedData($address) { if (false === filter_var($address, FILTER_VALIDATE_IP)) { throw new UnsupportedException('The MaxMindBinaryProvider does not support street addresses.'); } $geoIp = geoip_open($this->datFile, $this->openFlag); $geoIpRecord = GeoIP_record_by_addr($geoIp, $address); geoip_close($geoIp); if (false === $geoIpRecord instanceof \geoiprecord) { throw new NoResultException(sprintf('No results found for IP address %s', $address)); } return array($this->fixEncoding(array_merge($this->getDefaults(), array('countryCode' => $geoIpRecord->country_code, 'country' => $geoIpRecord->country_name, 'region' => $geoIpRecord->region, 'city' => $geoIpRecord->city, 'latitude' => $geoIpRecord->latitude, 'longitude' => $geoIpRecord->longitude)))); }
function index() { include 'geoip.inc'; $gi = geoip_open('resources/GeoIP.dat', GEOIP_STANDARD); $country_code = geoip_country_code_by_addr($gi, $_SERVER['REMOTE_ADDR']); //$this->data['country_code'] = $country_code; $country_name = geoip_country_name_by_addr($gi, $_SERVER['REMOTE_ADDR']); //$this->data['country_name'] = $country_name; // close the database geoip_close($gi); $visit = array('id' => NULL, 'negara' => $country_name, 'visit' => 'welcome'); $this->model_visit->add($visit); $data['gambar'] = $this->model_gambar->getAll(); $this->load->view('user/frontend/page/vwelcome', $data); }
public function __construct() { $gi = geoip_open(dirname(__FILE__) . "/GeoLiteCity.dat", GEOIP_STANDARD); $this->record = geoip_record_by_addr($gi, $_SERVER['REMOTE_ADDR']); // print $record->country_code . " " . $record->country_code3 . " " . $record->country_name . "\n"; // print $record->region . " " . $GEOIP_REGION_NAME[$record->country_code][$record->region] . "\n"; // print $record->city . "\n"; // print $record->postal_code . "\n"; // print $record->latitude . "\n"; // print $record->longitude . "\n"; // print $record->metro_code . "\n"; // print $record->area_code . "\n"; // print $record->continent_code . "\n"; geoip_close($gi); }
public function getCountry($ipAddress) { // get the country of the IP from the MAXMIND $country = ""; include_once "geoip.inc.php"; // read GeoIP database $handle = geoip_open("GeoIP.dat", GEOIP_STANDARD); // map IP to country $country = geoip_country_code_by_addr($handle, $ipAddress); // close database handler geoip_close($handle); if ($country == "" || empty($country)) { $country = "Unknown"; } return $country; }
public function localize() { include_once ROOT_DIR . '/libraries/geoloc/geoipcity.inc'; include_once ROOT_DIR . '/libraries/geoloc/geoipregionvars.php'; $gi = geoip_open(realpath(ROOT_DIR . '/libraries/geoloc/GeoLiteCity.dat'), GEOIP_STANDARD); $record = geoip_record_by_addr($gi, $_SERVER['REMOTE_ADDR']); /* echo $record->country_name . "\n"; echo $GEOIP_REGION_NAME[$record->country_code][$record->region] . "\n"; echo $record->city . "\n"; echo $record->postal_code . "\n"; echo $record->latitude . "\n"; echo $record->longitude . "\n";*/ geoip_close($gi); return $record; }
function get_geodata($ip) { require_once _TRACK_LIB_PATH . "/maxmind/geoip.inc.php"; require_once _TRACK_LIB_PATH . "/maxmind/geoipcity.inc.php"; require_once _TRACK_LIB_PATH . "/maxmind/geoipregionvars.php"; $gi = geoip_open(_TRACK_STATIC_PATH . "/maxmind/MaxmindCity.dat", GEOIP_STANDARD); $record = geoip_record_by_addr($gi, $ip); $isp = geoip_org_by_addr($gi, $ip); geoip_close($gi); $cur_country = $record->country_code; // Resolve GeoIP extension conflict if (function_exists('geoip_country_code_by_name') && $cur_country == '') { $cur_country = geoip_country_code_by_name($ip); } return array('country' => $cur_country, 'state' => $GEOIP_REGION_NAME[$record->country_code][$record->region], 'city' => $record->city, 'region' => $record->region, 'isp' => $isp); }