(.+?)#is', $vivod, $array);
//foreach ($array[1] as $item){ file_put_contents('1.txt', $item.'', FILE_APPEND); }
//file_put_contents('1.txt', array_unique(file('1.txt')));
//preg_match_all('/src=\"(.*?)\"/', $vivod, $array); // выбираем из переменной $content все src
//foreach ($array[1] as $item){ file_put_contents('1.txt', $item, FILE_APPEND); }
$type=strpos($url, '.css');
$type2=strpos($url, '.js');
if ($type===false){header('Content-Type:text/html'); if ($type2===false){} else { header('Content-Type:text/javascript'); }} else{header('Content-Type:text/css'); }
if (strpos($url, '.jpg')!==false){header('Content-Type:image/jpeg'); }
if (strpos($url, '.gif')!==false){header('Content-Type:image/gif'); }
if (strpos($url, '.png')!==false){header('Content-Type:image/png'); }
if (strpos($url, '.svg')!==false){header('Content-Type:image/svg+xml'); }
if (strpos($url, '.ico')!==false){header('Content-Type:image/vnd.microsoft.icon'); }
if (strpos($url, '.woff2')!==false){header('Content-Type:font/woff2'); }
$sim=substr($url, -1);
if ($sim=='/'){ $addr = substr($url,1,-1).'.html'; } else {$addr = substr($url,1,0).'.html';}
//echo $addr.'
'.$url;
header("HTTP/1.0 200 OK");
$vivod=file_get_contents($addr);
if ($vivod==''){$vivod=file_get_contents('.'.$url.'.css');}
if ($vivod==''){$vivod=file_get_contents('.'.$url.'.html');}
if ($vivod==''){$vivod=file_get_contents('.'.$url.'');}
if ($vivod==''){$vivod=file_get_contents('.'.$url.'/index.html');}
if ($vivod=='' and $type!==false){$url=strstr($url, '?', true); $vivod=file_get_contents('.'.$url.'');}
if (isset($_GET['p']) && is_numeric($_GET['p'])) { $vivod = file_get_contents('./index.html');}
$allHeaders = getallheaders();
$cont=$allHeaders['Accept'];
if (strpos($cont, 'text/html')!==false){
$vivod = str_replace("https://www.", "https://", $vivod);
$vivod = str_replace("http://www.", "https://", $vivod);
$vivod = str_replace("http://", "https://", $vivod);
}
if ($vivod == '') { $urjson = $_SERVER["REQUEST_URI"]; $urjson = str_replace(["/", ".html"], "", $urjson); $dir = '1/' . $urjson . '.json';
if (file_exists($dir)) { $filenameWithoutExtension = pathinfo($dir, PATHINFO_FILENAME); $jsonContent = file_get_contents($dir); $jsonData = json_decode($jsonContent, true);
$fileData = ['title' => $jsonData['title'], 'image' => $jsonData['image'], 'header' => $jsonData['name'], 'description' => $jsonData['description'], 'text' => $jsonData['text'], 'filename' => $filenameWithoutExtension, 'time' => filemtime($dir)];
$fileData['time'] = isset($jsonData['pubtime']) && !empty($jsonData['pubtime']) ? $jsonData['pubtime'] : filemtime($dir);
$vivod = file_get_contents('shabl.html'); $vivod = str_replace(["https://www.", "http://www.", "http://"], "https://", $vivod); $vivod = str_replace(["{title}", "{image}", "{description}", "{header}", "{body}", "{url}", "{date}"], [$fileData['title'], "", $fileData['description'], $fileData['header'], "
".$fileData['text'], $fileData['filename'], date("d.m.Y", $fileData['time'] - 5 * 60 * 60)], $vivod);}}
if (strpos($vivod, '