-1)) { // Code for IPv4 address $ip_address... $gi = geoip_open($dataBaseFileBath . "GeoIP.dat", GEOIP_STANDARD); $countryCode = geoip_country_code_by_addr($gi, $ipAddress); } else { // Code for IPv6 address $ip_address... $gi = geoip_open($dataBaseFileBath . "GeoIPv6.dat", GEOIP_STANDARD); $countryCode = geoip_country_code_by_addr_v6($gi, $ipAddress); } $siteData = array(); if ($countryCode != "") { $siteData = get_site_from_domain_countryCode($countryCode); } //&& $siteData['code'] != $GLOBALS['site']['code'] if ($count !== null) { if (count($siteData) > 0) { $setup["std_main_site_id"] = $GLOBALS['site']['id']; $GLOBALS['site']['code'] = $siteData['code']; $mainLanguage = get_language_by_site_id($siteData['id']); $GLOBALS['language']['id'] = $mainLanguage[0]['id']; $redirectUrl = '/' . $GLOBALS['site']['code'] . '/' . $mainLanguage[0]['code'] . '/'; $_SESSION['check_ip_switch'] = true; $_SESSION['current_site_code'] = $siteData['code']; universal_redirect($redirectUrl); } else { $_SESSION['check_ip_switch'] = false; $_SESSION['current_site_code'] = $GLOBALS['site']['code']; } } } } else { $_SESSION['check_ip_switch'] = false; $_SESSION['current_site_code'] = $GLOBALS['site']['code']; }