From e1eaf1a672f0a9fbecce764f6ba3921800601ab8 Mon Sep 17 00:00:00 2001 From: John Alanbrook Date: Tue, 2 Aug 2022 12:48:43 +0000 Subject: [PATCH] Initial website add --- router.php | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 router.php diff --git a/router.php b/router.php new file mode 100644 index 0000000..8350130 --- /dev/null +++ b/router.php @@ -0,0 +1,65 @@ +name = "Circus of the Stranded"; +$menu[0]->url = "/rooms/circus"; +$menu[1]->name = "Swan Song"; +$menu[1]->url = "/rooms/swan"; +$menu[2]->name = "Abstract Larceny"; +$menu[2]->url = "/rooms/abstract-larceny"; + +$mainphp = ""; + +if (preg_match('/\.(?:jpg|png|css|ico|scss|js|ttf|woff)/', $_SERVER["REQUEST_URI"])) { + return false; +} + + +$obj = NULL; +$tryuri = ltrim("$_SERVER[REQUEST_URI]", '/'); +$tryuri = strtok($tryuri, "?"); + +$jsonf = "index.json"; +$mainphp = "index.php"; + +do { + $tryf = "$tryuri/index"; + + if (file_exists("$tryf.json") && $jsonf == "index.json") { + $jsonf = "$tryf.json"; + } + + if (file_exists("$tryf.php") && $mainphp == "index.php") { + $mainphp = "$tryf.php"; + } + + $tryuri = substr($tryuri, 0, strrpos($tryuri, '/')); + +} while ($tryuri != "" && (!$obj || $mainphp == "")); + +$file = file_get_contents($jsonf); +$obj = json_decode($file); + +include "base.php"; + + +?> \ No newline at end of file