diff --git a/content/404.html b/content/404.html new file mode 100644 index 0000000..5c10c3c --- /dev/null +++ b/content/404.html @@ -0,0 +1,5 @@ +
+Back to blog +
+ diff --git a/content.php b/includes/content.php similarity index 90% rename from content.php rename to includes/content.php index 91d6742..4a05be9 100644 --- a/content.php +++ b/includes/content.php @@ -21,6 +21,11 @@ class Page $this->name . "\n"); } + public function getFile() + { + return $this->filename; + } + // For future-uses... public function getName() { diff --git a/index.php b/index.php index 6bc3122..8dd4bbf 100644 --- a/index.php +++ b/index.php @@ -19,7 +19,7 @@ --> @@ -69,6 +70,8 @@ $contactPage = new Page("Contact", "contact.html"); if (isset($_GET['content'])) { $content = $_GET['content']; + + // Function to remove directories function nodir($item) { return (!is_dir(Page::$contentFolder . $item)); @@ -78,14 +81,18 @@ $contactPage = new Page("Contact", "contact.html"); $files = (array_filter($dirContent, "nodir")); + // Iterate through all the files for a match (from ?content=) foreach($files as $file) { preg_match_all("/[a-z_\-0-9]*/i", $file, $withoutExt); if ($withoutExt[0][0] == $content) { include (Page::$contentFolder . $file); + terminate(); } } + // If no match was found, display a default page (here 404) + include (Page::$contentFolder . $pageNotFound->getFile()); terminate(); } // Subpage content ends diff --git a/stylesheet.css b/stylesheet.css index 598e3b4..25caac6 100644 --- a/stylesheet.css +++ b/stylesheet.css @@ -92,13 +92,13 @@ body a:link { color:#000000; - text-decoration:none; + text-decoration:underline; } a:hover { color:#000000; - text-decoration:underline; + text-decoration:none; } a:visited