Skip to content
Snippets Groups Projects
Commit 47dd071f authored by Mifkiyan's avatar Mifkiyan
Browse files

fix: access create & update event admin only

parent 20d1e741
Branches
No related merge requests found
<?php
session_start();
ob_start();
if (!isset($_SESSION["user_id"])) {
echo "here";
// User is not authenticated; redirect to login page
header("Location: /app/Views/login/login.php");
ob_end_flush();
}
require_once '../../Controllers/UserController.php';
$userController = new UserController();
$isAdmin = $userController->getUser($_SESSION['user_id'])['isAdmin'];
// Allow only admin to access this page
if (!$isAdmin){
header("Location: /app/Views/home/home.php");
ob_end_flush();
}
?>
<!DOCTYPE html>
<html lang="en">
......
<?php
session_start();
ob_start();
if (!isset($_SESSION["user_id"])) {
echo "here";
// User is not authenticated; redirect to login page
header("Location: /app/Views/login/login.php");
ob_end_flush();
}
require_once '../../Controllers/UserController.php';
$userController = new UserController();
$isAdmin = $userController->getUser($_SESSION['user_id'])['isAdmin'];
// Allow only admin to access this page
if (!$isAdmin){
header("Location: /app/Views/home/home.php");
ob_end_flush();
}
?>
<!DOCTYPE html>
<html lang="en">
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment