0) { $option = ' where pk_id = '.$_GET['homepageid']; } $domainQuery="select pk_id,domain,languages,fssl from homepage".$option; $domainlist=doMysql($domainQuery); foreach($domainlist as $domain){ if($option) { header('Location: http'.($_SERVER['HTTPS'] != 'on' && $domain['fssl'] == 1?'s':'').'://'.$domain['domain']); exit(); } else if($_SERVER['SERVER_NAME'] == $domain['domain']){ if($_SERVER['HTTPS'] != 'on' && $domain['fssl'] == 1) { header('Location: https://'.$domain['domain']); exit(); } $_GET['homepageid']=$domain['pk_id']; $ddata=$domain; //echo '##'.$domain['domain']."
"; } } if($_SERVER['SERVER_NAME'] == 'infomaster.mobi' || $ddata == '') { header("Location: http://www.infomaster.mobi"); die(); } function getDefaultLanguage() { if (isset($_SERVER["HTTP_ACCEPT_LANGUAGE"])) return parseDefaultLanguage($_SERVER["HTTP_ACCEPT_LANGUAGE"]); else return parseDefaultLanguage(NULL); } function parseDefaultLanguage($http_accept, $deflang = "en") { if(isset($http_accept) && strlen($http_accept) > 1) { # Split possible languages into array $x = explode(",",$http_accept); foreach ($x as $val) { #check for q-value and create associative array. No q-value means 1 by rule if(preg_match("/(.*);q=([0-1]{0,1}\.\d{0,4})/i",$val,$matches)) $lang[$matches[1]] = (float)$matches[2]; else $lang[$val] = 1.0; } #return default language (highest q-value) $qval = 0.0; foreach ($lang as $key => $value) { if ($value > $qval) { $qval = (float)$value; $deflang = $key; } } } return strtolower($deflang); } $homepageID=$_GET["homepageid"]; if($homepageID == '') $homepageID = 2; if(!isset($_SESSION["infomaster_viewLang"])){ if(ereg("de", $_SERVER["HTTP_ACCEPT_LANGUAGE"]) && strstr($ddata['languages'],'1')) $_SESSION["infomaster_viewLang"] = "de"; else if(strstr($ddata['languages'],'2')) $_SESSION["infomaster_viewLang"] = "en"; else if(strstr($ddata['languages'],'1')) $_SESSION["infomaster_viewLang"] = "de"; else if(strstr($ddata['languages'],'3')) $_SESSION["infomaster_viewLang"] = "it"; else if(strstr($ddata['languages'],'4')) $_SESSION["infomaster_viewLang"] = "ru"; else if(strstr($ddata['languages'],'5')) $_SESSION["infomaster_viewLang"] = "cz"; else if(strstr($ddata['languages'],'6')) $_SESSION["infomaster_viewLang"] = "hu"; else if(strstr($ddata['languages'],'7')) $_SESSION["infomaster_viewLang"] = "pl"; else if(strstr($ddata['languages'],'8')) $_SESSION["infomaster_viewLang"] = "sk"; else if(strstr($ddata['languages'],'9')) $_SESSION["infomaster_viewLang"] = "si"; } if(isset($_GET['setlang'])){ if(strstr($ddata['languages'],'2') && $_GET['setlang'] == 'en') $_SESSION["infomaster_viewLang"] = "en"; else if(strstr($ddata['languages'],'1') && $_GET['setlang'] == 'de') $_SESSION["infomaster_viewLang"] = "de"; else if(strstr($ddata['languages'],'3') && $_GET['setlang'] == 'it') $_SESSION["infomaster_viewLang"] = "it"; else if(strstr($ddata['languages'],'4') && $_GET['setlang'] == 'ru') $_SESSION["infomaster_viewLang"] = "ru"; else if(strstr($ddata['languages'],'5') && $_GET['setlang'] == 'cz') $_SESSION["infomaster_viewLang"] = "cz"; else if(strstr($ddata['languages'],'6') && $_GET['setlang'] == 'hu') $_SESSION["infomaster_viewLang"] = "hu"; else if(strstr($ddata['languages'],'7') && $_GET['setlang'] == '"') $_SESSION["infomaster_viewLang"] = "pl"; else if(strstr($ddata['languages'],'8') && $_GET['setlang'] == 'sk') $_SESSION["infomaster_viewLang"] = "sk"; else if(strstr($ddata['languages'],'9') && $_GET['setlang'] == 'si') $_SESSION["infomaster_viewLang"] = "si"; } if($_GET['dev']){ //print_r($_SESSION); //echo "
"; //print_r($_COOKIE); //print_r($_GET['homepageid']); } ?>