aboutsummaryrefslogtreecommitdiffstats
path: root/src/app/Controllers/HomeController.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/app/Controllers/HomeController.php')
-rw-r--r--src/app/Controllers/HomeController.php15
1 files changed, 6 insertions, 9 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');
+ }
}
}