Update 5 files

- /include/functions.php
- /html/admin.php
- /html/editpage.php
- /html/journal.php
- /html/users.php
This commit is contained in:
Jan BELLON 2024-03-07 21:06:52 +00:00
parent a2f8b3994c
commit a7f5ba0d53
5 changed files with 4 additions and 6 deletions

View File

@ -2,7 +2,7 @@
require "../include/variables.php"; require "../include/variables.php";
require "../include/functions.php"; require "../include/functions.php";
if($role < 4) { if($_SESSION['role'] < 4) {
header("Location: index.php"); header("Location: index.php");
http_response_code(404); http_response_code(404);
die(); die();

View File

@ -2,7 +2,7 @@
require "../include/variables.php"; require "../include/variables.php";
require "../include/functions.php"; require "../include/functions.php";
if($role < 3) { if($_SESSION['role'] < 3) {
header("Location: index.php"); header("Location: index.php");
http_response_code(404); http_response_code(404);
die(); die();

View File

@ -56,7 +56,7 @@ if (filter_var($_GET['article'], FILTER_VALIDATE_INT)) {
} else { } else {
$bdd = connect($dbhost, $dbname, $dbuser, $dbpass); $bdd = connect($dbhost, $dbname, $dbuser, $dbpass);
$req = $bdd->prepare("SELECT ID, titre, date, auteur FROM articles WHERE classification <= :role ORDER BY date DESC"); $req = $bdd->prepare("SELECT ID, titre, date, auteur FROM articles WHERE classification <= :role ORDER BY date DESC");
$req->bindParam(":role", $role); $req->bindParam(":role", $_SESSION['role']);
$req->execute(); $req->execute();
$resultat = $req->fetchAll(PDO::FETCH_ASSOC); $resultat = $req->fetchAll(PDO::FETCH_ASSOC);

View File

@ -2,7 +2,7 @@
require "../include/variables.php"; require "../include/variables.php";
require "../include/functions.php"; require "../include/functions.php";
if($role < 4) { if($_SESSION['role'] < 4) {
header("Location: index.php"); header("Location: index.php");
http_response_code(404); http_response_code(404);
die(); die();

View File

@ -1,8 +1,6 @@
<?php <?php
session_start(); session_start();
$role = isset($_SESSION['role']) ? (int)$_SESSION['role'] : 0;
function nav($nav, $role) { function nav($nav, $role) {
foreach($nav as $name => $url) { foreach($nav as $name => $url) {
echo "<a href='$url'><div class='navitem'>$name</div></a>"; echo "<a href='$url'><div class='navitem'>$name</div></a>";