Add website login, logout pages and update index with session management

Co-authored-by: iaretechnician <2749183+iaretechnician@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2025-10-22 00:49:18 +00:00
parent a0790f58eb
commit a7bb9d5b31
3 changed files with 305 additions and 3 deletions

28
_website/logout.php Normal file
View file

@ -0,0 +1,28 @@
<?php
// Start the website session
session_name("gameservers_website");
session_start();
// Include database connection for logging
require_once('db.php');
// Log the logout
if (isset($_SESSION['website_username'])) {
logger("Website logout: " . $_SESSION['website_username']);
}
// Destroy all session data
$_SESSION = array();
// Destroy the session cookie
if (isset($_COOKIE[session_name()])) {
setcookie(session_name(), '', time() - 42000, '/');
}
// Destroy the session
session_destroy();
// Redirect to home page
header('Location: /');
exit();
?>