It goes through this code once the user comes into the site from the different countries.
<? if ($COOKIE['visitor_language']== "en") { $lg_id = "UA-1436977-1"; } elseif ($COOKIE['visitor_language']== "fr") { $lg_id = "UA-1436987-1"; } elseif ($COOKIE['visitor_language']== "de") { $lg_id = "UA-1436993-1"; } elseif ($COOKIE['visitor_language']== "nl") { $lg_id = "UA-1436998-1"; } else { $lg_id = "UA-1437004-1"; } ?>This is where we set the language in the cookie. This is the code for the cookies:
<? /* Script to run at starup */ /* Detecting browser's default language */ if (!isset($_COOKIE['visitor_language'])) { $BrowserLang = substr($_SERVER["HTTP_ACCEPT_LANGUAGE"],0,2); switch($BrowserLang) { case "en": $_SESSION['DEFAULT_LANG'] = "en"; break; case "fr": $_SESSION['DEFAULT_LANG'] = "fr"; break; case "de": $_SESSION['DEFAULT_LANG'] = "de"; break; case "nl": $_SESSION['DEFAULT_LANG'] = "nl"; break; case "es": $_SESSION['DEFAULT_LANG'] = "es"; break; } } /* Set Default site language region */ if (!isset($_COOKIE['visitor_language'])) { if (getenv('HTTP_X_FORWARDED_FOR')) { $visitor_ip = getenv('HTTP_X_FORWARDED_FOR'); } else { $visitor_ip = getenv('REMOTE_ADDR'); } $VisitorInfo = file('http://api.hostip.info/get_html.php?ip='. $visitor_ip .'&position=true'); if($VisitorInfo != "") { $VisitorRegion = substr($VisitorInfo[0], -4, 2); switch($VisitorRegion) { case "FR": $_SESSION['DEFAULT_LANG'] = "fr"; break; case "DE": $_SESSION['DEFAULT_LANG'] = "de"; break; case "NL": $_SESSION['DEFAULT_LANG'] = "nl"; break; case "ES": $_SESSION['DEFAULT_LANG'] = "es"; break; } } } /* Register default language in cookie */ $time = time(); if (isset($_COOKIE['visitor_language'])) { $_SESSION['DEFAULT_LANG'] = $_COOKIE['visitor_language']; setcookie ("visitor_language",$_SESSION['DEFAULT_LANG'], $time+(60 * 60 * 24 * 60)); } else { $visitor_lang_pref = $_SESSION['DEFAULT_LANG']; setcookie ("visitor_language",$visitor_lang_pref, $time+(60 * 60 * 24 * 60)); } ?>Well im testing it the whole time and ran out of ideas of how to make this thing to work, coz my one friend in France is testing and when he goes to the website it brings back the english number $lg_id = “UA-1436977-1” instead of the french number $lg_id = “UA-1436987-1”, so how do i go from here, coz i’ve came to this point where im stuck and feel so stupid(then i ask myself what am i doing in programming).