diff --git a/public/addFilament.php b/public/addFilament.php
index 99199a6..a8b3e72 100644
--- a/public/addFilament.php
+++ b/public/addFilament.php
@@ -1,4 +1,6 @@
-
+
diff --git a/src/filamentTracker/addFilament.php b/src/filamentTracker/addFilament.php
index 0993f63..f1d8197 100644
--- a/src/filamentTracker/addFilament.php
+++ b/src/filamentTracker/addFilament.php
@@ -5,6 +5,7 @@ require_once '../envLoader.php';
loadEnv(__DIR__ . '/../../.env');
include '../src/session_check.php';
+checkUserRole(['admin']);
use Goutte\Client;
diff --git a/src/header.php b/src/header.php
index f70249b..09bcff6 100644
--- a/src/header.php
+++ b/src/header.php
@@ -75,5 +75,28 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/session_check.php b/src/session_check.php
index f34a1fb..d878d5f 100644
--- a/src/session_check.php
+++ b/src/session_check.php
@@ -1,6 +1,38 @@
SESSION_TIMEOUT) {
+ // Session expired
+ session_unset();
+ session_destroy();
+ redirectToLogin("Session expired. Please log in again.");
+} else {
+ $_SESSION['lastActivity'] = time(); // Update activity timestamp
+}
+
+// Function to check user roles
+function checkUserRole($allowedRoles = []) {
+ if (!isset($_SESSION['role']) || !in_array($_SESSION['role'], $allowedRoles)) {
+ $_SESSION['errorMessage'] = "Access denied: You do not have the required permissions.";
+ header("Location: dashboard.php"); // Redirect to dashboard or another page
+ exit();
+ }
+}
+
+// Function to redirect to login with optional message
+function redirectToLogin($message = '') {
+ if (!empty($message)) {
+ $_SESSION['errorMessage'] = $message;
+ }
header("Location: login.php");
exit();
}