diff --git a/public/css/dragon.css b/public/css/dragon.css index 0270451..a3b43c5 100644 --- a/public/css/dragon.css +++ b/public/css/dragon.css @@ -22,6 +22,36 @@ body { justify-content: space-between; margin-bottom: 1rem; } + + footer { + margin-top: 1rem; + display: flex; + justify-content: space-between; + align-items: center; + background-color: rgba(0, 0, 0, 0.25); + padding: 0.5rem; + color: white; + } + + div#content { + display: flex; + flex-direction: row; + gap: 1rem; + + aside#left { + flex-grow: 1; + max-width: 250px; + } + + aside#right { + flex-grow: 1; + max-width: 250px; + } + + main { + flex-grow: 1; + } + } } .form-group { @@ -68,4 +98,4 @@ div.alert { color: hsl(359deg, 68%, 11%); background-color: hsl(359deg, 68%, 71%); } -} \ No newline at end of file +} diff --git a/server/app/Auth.php b/server/app/Auth.php index 233d246..df82044 100644 --- a/server/app/Auth.php +++ b/server/app/Auth.php @@ -13,6 +13,11 @@ class Auth // id of the player public static int $id = 0; + public function __construct() + { + + } + public function login(string $identifier, string $password, bool $remember = false): bool { // delete the old session @@ -32,11 +37,11 @@ class Auth return true; } - private function remember(int $id): array|false + private function remember(int $id): array { $data = ['player_id' => $id, 'token' => token()]; - Session::createOrUpdate($data); + Session::createOrUpdate($data); // save the token in the database, overwriting the old one if it exists setcookie(self::COOKIE_NAME, implode('::', $data), strtotime('+30 days'), '/', '', true, true); return $data; @@ -46,6 +51,11 @@ class Auth { if (isset($_SESSION['player_id'])) unset($_SESSION['player_id']); if (isset($_COOKIE[self::COOKIE_NAME])) setcookie(self::COOKIE_NAME, '', time() - 86400, '/', '', true, true); + if (ini_get("session.use_cookies")) { + $params = session_get_cookie_params(); + setcookie(session_name(), '', time() - 42000, $params["path"], $params["domain"], $params["secure"], $params["httponly"]); + } + session_destroy(); } public function good(): bool diff --git a/server/templates/auth/login.php b/server/templates/auth/login.php deleted file mode 100644 index e69de29..0000000 diff --git a/server/templates/gate/login.php b/server/templates/gate/login.php new file mode 100644 index 0000000..ce01362 --- /dev/null +++ b/server/templates/gate/login.php @@ -0,0 +1 @@ +hello diff --git a/server/templates/partials/footer.php b/server/templates/partials/footer.php index a56ca53..6f43ddc 100644 --- a/server/templates/partials/footer.php +++ b/server/templates/partials/footer.php @@ -1 +1,11 @@ -footer \ No newline at end of file +
+ © +
+ +
+ q("SELECT COUNT(id) FROM players WHERE last_online > ?;", [time() - 300])->fetchColumn() ?> players online +
+ +
+ queries() ?> queries in time(), 2) ?> seconds +