'; $path = getcwd(); $DOMAINS = ['']; $scriptYAMetrica = ' '; $mobile = ''; $route = $_SERVER['REQUEST_URI']; $route = removeBOM($route); //echo urldecode($path.$route); $route = preg_replace('/[^\x00-\x7F]+/', '', $route); $route = str_replace("..",".", $route); $route = str_replace("?","_", $route); $route = str_replace("&","_", $route); $route = rtrim($route,"_"); $content =""; $filename = (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN')? iconv('UTF-8', 'windows-1251', urldecode($path.$route)): urldecode($path.$route); $filename2 = str_replace("/_","_",$filename); if ( (file_exists($filename2."/index.html") || file_exists($filename2)) && !(file_exists($filename."/index.html") || file_exists($filename))) $filename = $filename2; //echo $filename; if (file_exists($filename."/index.html") || (file_exists($filename) && !is_dir($filename))){ if (file_exists($filename) && is_file($filename)) $content = file_get_contents($path.$route); else $content = file_get_contents($filename."/index.html"); if (strpos($content, "charset=windows-1251")>0) $content = iconv('CP1251', 'UTF-8', $content); } else { header("HTTP/1.1 404 Not Found"); $content = file_get_contents($path."/index.html"); if (strpos($content, "charset=windows-1251")>0) $content = iconv('CP1251', 'UTF-8', $content); } if (strpos($filename,'yandex_6e0681956f56d6ad.html')>0){ echo $content; exit(); } foreach($DOMAINS as $DOMAIN){ $content = str_replace("https://$DOMAIN", "", $content); $content = str_replace("https://www.$DOMAIN", "", $content); $content = str_replace("http://$DOMAIN", "", $content); $content = str_replace("http://www.$DOMAIN", "", $content); $content = str_replace("$DOMAIN", "", $content); } if ($use_mobile) { $content = str_replace("", '', $content); $content = str_replace("","\r\n".$mobile, $content); } $content = str_replace(" ",$scriptYAMetrica."\r\n ", $content); echo $content;