<!DOCTYPE html>
<html lang="en">

<head>
    <?php
    if (isset($_GET['page'])) { $page = $_GET['page']; }
    if (isset($page)) {
	if (!is_file($page.".md")) {
	    header($_SERVER["SERVER_PROTOCOL"]." 404 Not Found" );
	    include($_SERVER['DOCUMENT_ROOT']."/system_pages/404.php");
	    exit();
    }}
    include($_SERVER['DOCUMENT_ROOT']."/sitehead.php");
    ?>
<title>Palace Reign</title>
</head>


<body>
<?php
include($_SERVER['DOCUMENT_ROOT']."/sitemenu.php");
?>
<div>
<main role="main">	
<?php
include($_SERVER['DOCUMENT_ROOT']."/system_pages/Parsedown.php");
include($_SERVER['DOCUMENT_ROOT']."/system_pages/ParsedownExtra.php");
if (isset($_GET['page'])) { $page = $_GET['page']; }
if (isset($page)) {
	print ParsedownExtra::instance()
        ->text(file_get_contents($page.".md"));
}
else {
	print ParsedownExtra::instance()
        ->text(file_get_contents("index.md"));
}
?>
</main>
</div>

</body>

</html>
