diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/app/Controllers/HomeController.php | 15 | ||||
| -rw-r--r-- | src/app/Views/home/index.php | 3 |
2 files changed, 6 insertions, 12 deletions
diff --git a/src/app/Controllers/HomeController.php b/src/app/Controllers/HomeController.php index 8c462a0..f73e550 100644 --- a/src/app/Controllers/HomeController.php +++ b/src/app/Controllers/HomeController.php @@ -1,21 +1,18 @@ <?php declare(strict_types=1); -// Handles the home page and verifies database connectivity. +// Home page: redirects to gallery if logged in, login page otherwise. namespace App\Controllers; -use App\Database; - class HomeController { public function index(): void { - $db = Database::getInstance()->getPdo(); - $stmt = $db->query('SELECT 1'); - $dbStatus = $stmt ? 'Connected' : 'Failed'; - - $content = __DIR__ . '/../Views/home/index.php'; - include __DIR__ . '/../Views/layouts/main.php'; + if (isset($_SESSION['user_id'])) { + header('Location: /gallery'); + } else { + header('Location: /login'); + } } } diff --git a/src/app/Views/home/index.php b/src/app/Views/home/index.php deleted file mode 100644 index f5cde93..0000000 --- a/src/app/Views/home/index.php +++ /dev/null @@ -1,3 +0,0 @@ -<?php // Home page: displays a welcome message and database connection status.?> -<h1>Welcome to Camagru</h1> -<p>Database status: <?= htmlspecialchars($dbStatus) ?></p> |
