diff --git a/index.php b/index.php index b3d9bbc..9a8be73 100644 --- a/index.php +++ b/index.php @@ -1 +1,44 @@ Critical error: " . $e->getMessage() . "
This isn't your fault. Please contact the developers."; + exit; +} + +// TODO: Init PDO. + +// Starts the session +// TODO: write this to use the database to work across more than one server +session_start(); + + +$uri_string = $_SERVER['REQUEST_URI']; // `/foo/bar?bar=foo&foo=bar` +$uri_explode = explode('?', $uri_string); +$path = $uri_explode[0]; // `/foo/bar` +$path_array = explode('/', $path); + +// Remove trailing slashes +if (str_ends_with($path, '/') && $path != '/') { + http_response_code(308); + header('Location: '.substr($path,0, -1)); + exit; +} + +$routes = [ + '' => function () { require 'views/home.php'; }, +]; + +//print_r($path_array); + +if (array_key_exists($path_array[1], $routes)) { + $res = $routes[$path_array[1]](); + if ($res == 404) { + require "views/404.php"; + } +} else { + require "views/404.php"; +} + diff --git a/styles/base.css b/styles/base.css new file mode 100644 index 0000000..0fe5414 --- /dev/null +++ b/styles/base.css @@ -0,0 +1,52 @@ + +@import "colours.css"; + +:root { + color-scheme: light dark; + font-family: "Montserrat", system-ui, sans-serif; +} + +body { + margin: 0; +} + +header { + display: flex; + align-items: center; + padding: 1rem; + + gap: 1rem; + + justify-content: space-between; + + background: var(--flax); + color: var(--dark-slate-gray); +} + +main { + flex: 1; +} + +#content { + margin: 1rem; +} + +@media screen and (prefers-color-scheme: dark) { + header { + background: var(--dark-slate-gray); + color: var(--flax); + } +} + +/* Font things */ +.bc-1 { + font-weight: 700; +} + +.bc-2 { + font-weight: 600; +} + +.bc-3 { + font-weight: 400; +} diff --git a/styles/colours.css b/styles/colours.css new file mode 100644 index 0000000..a162b57 --- /dev/null +++ b/styles/colours.css @@ -0,0 +1,13 @@ + +:root { + /* ByeCorps colour scheme. Use sparsely on this site. */ + --byecorps-blue: #1b5652; + --byecorps-white: #e6feff; + + /* ByeCorps ID colour scheme. Use on this site. */ + --black-bean: #330f0a; + --dark-slate-gray: #394f49; + --fern-green: #65743a; + --flax: #efdd8d; + --mindaro: #f4fdaf; +} diff --git a/views/404.php b/views/404.php index b3d9bbc..90db39d 100644 --- a/views/404.php +++ b/views/404.php @@ -1 +1,25 @@ + + + + + + 404 ~> ByeCorps ID + + + + +
+
+

404

+

Sorry, but that doesn't exist anymore.

+

(or it never existed)

+
+
+ + + + + diff --git a/views/home.php b/views/home.php new file mode 100644 index 0000000..510bb4c --- /dev/null +++ b/views/home.php @@ -0,0 +1,17 @@ + + + + + ByeCorps ID + + + + +

ByeCorps ID

+ + + + + + + diff --git a/views/partials/head.php b/views/partials/head.php new file mode 100644 index 0000000..121a746 --- /dev/null +++ b/views/partials/head.php @@ -0,0 +1,12 @@ + + + + + + +' . $page_title . ''; +} +?> diff --git a/views/partials/header.php b/views/partials/header.php index b3d9bbc..33a9914 100644 --- a/views/partials/header.php +++ b/views/partials/header.php @@ -1 +1,12 @@ - +
+ + ByeCorps ID + +
+ +
+ Login disabled. +
+