diff --git a/admin/index.php b/admin/index.php index c8236b8..1f1be43 100644 --- a/admin/index.php +++ b/admin/index.php @@ -7,7 +7,7 @@ $page = 'photos'; /* Gestion de la connexion */ session_start(); if (!isset($_SESSION['connected']) || $_SESSION['connected'] == false) { - header('location: login.php?redirect_to=./admin/'); + header('location: ../login.php?redirect_to=./admin/'); } $events = getEvenements($bdd, $_SESSION['site']); @@ -19,6 +19,7 @@ $site = $_SESSION['site']; /* Gestion de l'accès à la page */ $minPoids = 45; if (!verifyPoids($bdd, $_SESSION['username'], $minPoids)) { + die("Vous n'avez pas l'autorisation"); header('location: ../index.php'); } @@ -70,6 +71,9 @@ $uploadDir = "../Photos/INTRANET/"; + + + diff --git a/admin/modifyEvent.php b/admin/modifyEvent.php index 3c811cb..b3f4991 100644 --- a/admin/modifyEvent.php +++ b/admin/modifyEvent.php @@ -3,7 +3,6 @@ include("../Assets/functions.php"); $config = json_decode(file_get_contents("../Assets/config.json"), true); $bdd = connectBDD("localhost", $config["BDD_USER"], $config["BDD_PASSWD"], $config["BDD_NAME"]); -$page = 'photos'; session_start(); @@ -19,19 +18,16 @@ if (!verifyPoids($bdd, $_SESSION['username'], $minPoids)) { } $eventId = $_GET['id'] ?? null; -if (!$eventId) { - die("ID évènement manquant."); -} $titre = getEventName($bdd, $eventId) ?? ''; $couverture = getEventBigImage($bdd, $eventId) ?? ''; -if ($_SERVER['REQUEST_METHOD'] === 'POST') { +if ($_SERVER['REQUEST_METHOD'] === 'POST' && (!$_POST['new'] ?? '')) { if (!empty($_POST['title'])) { updateEventTitle($bdd, $eventId, trim($_POST['title'])); } if (!empty($_FILES['couverture']['name'])) { - $uploadDir = "../uploads/"; + $uploadDir = "../Photos/INTRANET/"; $fileTmpPath = $_FILES["couverture"]["tmp_name"]; $fileSize = $_FILES["couverture"]["size"]; @@ -59,6 +55,10 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { header("Location: ?id=" . $eventId); exit; } +if($_POST['new'] ?? ''){ + // + die('test'); +} ?> @@ -140,7 +140,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {

-

Aucune image définie

@@ -160,6 +160,9 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { class="form-control" accept="image/*">
+ + +