aboutsummaryrefslogtreecommitdiffstats
path: root/src
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
parentf9ad3f4dc05252839457579303a4e0a0f94d8b80 (diff)
downloadcamagru-6f300d7676aa36903c1a279aeb100d6f4caf1197.tar.gz
camagru-6f300d7676aa36903c1a279aeb100d6f4caf1197.zip
Replace home page with redirect to gallery or login
Diffstat (limited to 'src')
-rw-r--r--src/app/Controllers/HomeController.php15
-rw-r--r--src/app/Views/home/index.php3
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>