aboutsummaryrefslogtreecommitdiffstats
path: root/src/app/Controllers/HomeController.php
diff options
context:
space:
mode:
authorThomas Vanbesien <tvanbesi@proton.me>2026-03-21 22:57:36 +0100
committerThomas Vanbesien <tvanbesi@proton.me>2026-03-21 22:57:36 +0100
commit6f300d7676aa36903c1a279aeb100d6f4caf1197 (patch)
tree134b4f7abee2525813c866f883997e6ab15b701b /src/app/Controllers/HomeController.php
parentf9ad3f4dc05252839457579303a4e0a0f94d8b80 (diff)
downloadcamagru-6f300d7676aa36903c1a279aeb100d6f4caf1197.tar.gz
camagru-6f300d7676aa36903c1a279aeb100d6f4caf1197.zip
Replace home page with redirect to gallery or login
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');
+ }
}
}