Fix: check if the session is set before using it

This commit is contained in:
Filip Rojek 2024-12-27 02:28:03 +01:00
parent 2847231376
commit d9f632da26

View File

@ -24,7 +24,7 @@ require_once models . 'Habit.php';
// Initialize router // Initialize router
$router = new Router(); $router = new Router();
if(!$_SESSION['user']) { if(!isset($_SESSION['user'])) {
$router->add('/', 'HomeController@index'); $router->add('/', 'HomeController@index');
} else { } else {
$router->add('/', 'DashboardController@reroute', ['RequireAuth']); $router->add('/', 'DashboardController@reroute', ['RequireAuth']);