diff --git a/html/admin.php b/html/admin.php index b7732d01..77466ac5 100644 --- a/html/admin.php +++ b/html/admin.php @@ -2,7 +2,7 @@ require "../include/variables.php"; require "../include/functions.php"; -if(isset($_SESSION['role']) == false || $_SESSION['role'] < 4) { +if($role < 4) { header("Location: login.php"); http_response_code(404); die(); diff --git a/html/editpage.php b/html/editpage.php index 249a2987..ca5baeb6 100644 --- a/html/editpage.php +++ b/html/editpage.php @@ -2,7 +2,7 @@ require "../include/variables.php"; require "../include/functions.php"; -if(isset($_SESSION['role']) == false || $_SESSION['role'] < 3) { +if($role < 3) { header("Location: login.php"); http_response_code(404); die(); diff --git a/html/journal.php b/html/journal.php index 210d0478..e8412b6e 100644 --- a/html/journal.php +++ b/html/journal.php @@ -56,7 +56,7 @@ if (filter_var($_GET['article'], FILTER_VALIDATE_INT)) { } else { $bdd = connect($dbhost, $dbname, $dbuser, $dbpass); $req = $bdd->prepare("SELECT ID, titre, date, auteur FROM articles WHERE classification <= :role ORDER BY date DESC"); - $req->bindParam(":role", $_SESSION['role']); + $req->bindParam(":role", $role); $req->execute(); $resultat = $req->fetchAll(PDO::FETCH_ASSOC); diff --git a/html/upload.php b/html/upload.php index dcda8a98..5b0ae6a0 100644 --- a/html/upload.php +++ b/html/upload.php @@ -4,7 +4,7 @@ require "../include/functions.php"; $repertoire = "/var/www/e59/"; -if(isset($_SESSION['role']) == false || $_SESSION['role'] < 3) { +if($role < 3) { header("Location: login.php"); http_response_code(404); die(); diff --git a/include/variables.php b/include/variables.php index 32c1664c..f088dd43 100644 --- a/include/variables.php +++ b/include/variables.php @@ -15,4 +15,6 @@ $navadmin = $nav; $status = ""; $classifications = $config['classifications']; +$role = isset($_SESSION['role']) ? $_SESSION['role'] : 0; + ?> \ No newline at end of file