diff --git a/.gitignore b/.gitignore index 3d0dbe4..5ac536b 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ -tests/ \ No newline at end of file +tests/ +uploads/ +Photos \ No newline at end of file diff --git a/Assets/config.json b/Assets/config.json index 9a11b7d..9a85f40 100644 --- a/Assets/config.json +++ b/Assets/config.json @@ -1,5 +1,6 @@ { "BDD_USER": "root", "BDD_PASSWD": "root", - "BDD_NAME": "intranet" + "BDD_NAME": "intranet", + "LOCAL_IMG_PREFIXE": "./Photos/INTRANET/" } \ No newline at end of file diff --git a/Assets/functions.php b/Assets/functions.php index 375565e..d7e62de 100644 --- a/Assets/functions.php +++ b/Assets/functions.php @@ -209,4 +209,36 @@ function verifyPoids($bdd, $username, $minPoids) { } return false; +} + +function updateEventTitle($bdd, $eventid, $titre){ + $stmt = mysqli_prepare( + $bdd, + "UPDATE evenements SET titre = ? WHERE id = ?" + ); + + mysqli_stmt_bind_param($stmt, "si", $titre, $eventid); + mysqli_stmt_execute($stmt); + + $success = mysqli_stmt_affected_rows($stmt) >= 0; + + mysqli_stmt_close($stmt); + + return $success; +} + +function updateEventImage($bdd, $eventId, $newFileName){ + $stmt = mysqli_prepare( + $bdd, + "UPDATE evenements SET couverture = ? WHERE id = ?" + ); + + mysqli_stmt_bind_param($stmt, "si", $newFileName, $eventId); + mysqli_stmt_execute($stmt); + + $success = mysqli_stmt_affected_rows($stmt) >= 0; + + mysqli_stmt_close($stmt); + + return $success; } \ No newline at end of file diff --git a/admin/index.php b/admin/index.php index eb15de9..c58a9f0 100644 --- a/admin/index.php +++ b/admin/index.php @@ -22,6 +22,8 @@ if (!verifyPoids($bdd, $_SESSION['username'], $minPoids)) { header('location: ../index.php'); } +$uploadDir = "../uploads/"; + ?> @@ -62,7 +64,7 @@ if (!verifyPoids($bdd, $_SESSION['username'], $minPoids)) {

- Image de couverture + Image de couverture Modifier
diff --git a/admin/modifyEvent.php b/admin/modifyEvent.php index 932b7fe..3c811cb 100644 --- a/admin/modifyEvent.php +++ b/admin/modifyEvent.php @@ -1,31 +1,66 @@ + @@ -33,18 +68,33 @@ $titre = getEventName($bdd, $_GET['id']) ?? 'Titre?'; Gestion Intranet - + + + - -

Gestion de l'intranet

- -