2024-01-11 09:27:03 +01:00
|
|
|
<?php
|
|
|
|
require "secrets/config.php";
|
2024-01-16 19:24:40 +01:00
|
|
|
require "lib/navpages.php";
|
|
|
|
require "lib/routing.php";
|
2024-01-11 09:27:03 +01:00
|
|
|
|
|
|
|
$default_page = "domov";
|
|
|
|
|
2024-01-12 15:37:02 +01:00
|
|
|
$default_site = "home";
|
|
|
|
|
2024-01-11 09:27:03 +01:00
|
|
|
$template_dir = "templates/";
|
|
|
|
|
2024-01-11 16:00:36 +01:00
|
|
|
$static_page_dir = "pages/";
|
2024-01-11 09:27:03 +01:00
|
|
|
|
|
|
|
$dynamic_page_dir = "dynamic/";
|
|
|
|
|
|
|
|
$subdomain = basename(explode('.', $_SERVER['HTTP_HOST'])[0]);
|
2024-01-11 09:56:09 +01:00
|
|
|
$domain = basename(explode('.', $_SERVER['HTTP_HOST'])[1]);
|
|
|
|
$tld = basename(explode('.', $_SERVER['HTTP_HOST'])[2]);
|
2024-01-16 19:24:40 +01:00
|
|
|
$page_name = basename($_SERVER["QUERY_STRING"]);
|
|
|
|
$protocol = getProtocol();
|
2024-01-11 09:47:52 +01:00
|
|
|
|
2024-01-12 15:37:02 +01:00
|
|
|
if (empty($tld)){
|
|
|
|
header("Location: $protocol$default_site.$subdomain.$domain/$default_page");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2024-01-11 09:47:52 +01:00
|
|
|
if (empty($page_name)){
|
2024-01-12 15:37:02 +01:00
|
|
|
header("Location: $protocol$subdomain.$domain.$tld/$default_page");
|
2024-01-11 09:47:52 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2024-01-16 19:24:40 +01:00
|
|
|
session_set_cookie_params(0, '/', ".$domain.$tld", true, true);
|
|
|
|
session_start();
|
2024-01-11 09:27:03 +01:00
|
|
|
|
2024-01-16 19:38:42 +01:00
|
|
|
echo getPage($routerConfig);
|
2024-01-11 09:27:03 +01:00
|
|
|
|
|
|
|
?>
|