From 536c31908b4e4d8e2f7c29a7b38a509165bfd447 Mon Sep 17 00:00:00 2001 From: Erwann Philippe Date: Wed, 4 Mar 2026 17:34:46 +0100 Subject: [PATCH] =?UTF-8?q?Gestion=20de=20la=20modification=20des=20actual?= =?UTF-8?q?it=C3=A9s,=20mise=20=C3=A0=20jour=20de=20la=20bdd?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/functions.php | 59 ++++++++++ admin/index.php | 4 +- admin/modifyActuality.php | 75 ++++++++++++ admin/modifyGallery.php | 46 +------- admin/modifySpecificActuality.php | 189 ++++++++++++++++++++++++++++++ index.php | 3 +- intranet v1.sql | 64 +++++++--- 7 files changed, 376 insertions(+), 64 deletions(-) create mode 100644 admin/modifyActuality.php create mode 100644 admin/modifySpecificActuality.php diff --git a/Assets/functions.php b/Assets/functions.php index d7e62de..0c67ed8 100644 --- a/Assets/functions.php +++ b/Assets/functions.php @@ -240,5 +240,64 @@ function updateEventImage($bdd, $eventId, $newFileName){ mysqli_stmt_close($stmt); + return $success; +} + +function getSpecificActus($bdd, $id) +{ + $results = mysqli_query($bdd, "SELECT * FROM `actus` WHERE `id`=" . $id); + $return = []; + + while ($row = mysqli_fetch_assoc($results)) { + $return[] = $row; + } + return $return; +} + +function updateActuImage($bdd, $actuId, $newFileName){ + $stmt = mysqli_prepare( + $bdd, + "UPDATE actus SET image = ? WHERE id = ?" + ); + + mysqli_stmt_bind_param($stmt, "si", $newFileName, $actuId); + mysqli_stmt_execute($stmt); + + $success = mysqli_stmt_affected_rows($stmt) >= 0; + + mysqli_stmt_close($stmt); + + return $success; +} + +function updateActuTitle($bdd, $actuId, $titre){ + $stmt = mysqli_prepare( + $bdd, + "UPDATE actus SET titre = ? WHERE id = ?" + ); + + mysqli_stmt_bind_param($stmt, "si", $titre, $actuId); + mysqli_stmt_execute($stmt); + + $success = mysqli_stmt_affected_rows($stmt) >= 0; + + mysqli_stmt_close($stmt); + + return $success; +} + +function updateActuContent($bdd, $actuId, $content){ + $stmt = mysqli_prepare( + $bdd, + "UPDATE actus SET actu = ? WHERE id = ?" + ); + + mysqli_stmt_bind_param($stmt, "si", $content, $actuId); + 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 c58a9f0..c8236b8 100644 --- a/admin/index.php +++ b/admin/index.php @@ -22,7 +22,7 @@ if (!verifyPoids($bdd, $_SESSION['username'], $minPoids)) { header('location: ../index.php'); } -$uploadDir = "../uploads/"; +$uploadDir = "../Photos/INTRANET/"; ?> @@ -49,7 +49,7 @@ $uploadDir = "../uploads/"; Évènements diff --git a/intranet v1.sql b/intranet v1.sql index 2802853..d280a47 100644 --- a/intranet v1.sql +++ b/intranet v1.sql @@ -46,10 +46,10 @@ CREATE TABLE IF NOT EXISTS `evenements` ( -- Listage des données de la table intranet.evenements : ~9 rows (environ) INSERT INTO `evenements` (`id`, `date`, `titre`, `couverture`, `site_id`) VALUES - (1, '2026-02-24', 'Évènement 1 : bla', 'https://cdn.pixabay.com/photo/2016/11/21/06/53/beautiful-natural-image-1844362_1280.jpg', 1), - (2, '2026-02-24', 'Évènement 2 : lorem', 'https://static.vecteezy.com/system/resources/thumbnails/057/068/323/small/single-fresh-red-strawberry-on-table-green-background-food-fruit-sweet-macro-juicy-plant-image-photo.jpg', 1), - (3, '2026-02-24', 'ipsum', 'https://blog.digitalcook.fr/wp-content/uploads/2021/09/Digital-image-processing.jpg', 1), - (4, '2026-02-24', 'vrfrpvof', 'https://images.ctfassets.net/hrltx12pl8hq/3nkTxmxi2NfpMEZ4IWSJaG/0198fe49a115f5d9b914ce7a806a09cc/0_hero__5_.webp?fit=fill&w=600&h=400', 1), + (1, '2026-02-24', '50 ans des papillons blancs', 'event_1_1772616599.JPG', 1), + (2, '2026-02-24', 'Accueil des nouveaux salariés', 'event_2_1772616804.JPG', 1), + (3, '2026-02-24', 'AG 2014 La longueville', 'event_3_1772619824.JPG', 1), + (4, '2026-02-24', 'Fête associative 2018', 'event_4_1772620173.jpg', 1), (5, '2026-02-24', 'ptkhpkth', 'https://upload.wikimedia.org/wikipedia/commons/b/b6/Image_created_with_a_mobile_phone.png', 1), (6, '2026-02-24', 'miaou', 'https://static.vecteezy.com/ti/photos-gratuite/t2/36324708-ai-genere-image-de-une-tigre-en-marchant-dans-le-foret-photo.jpg', 2), (7, '2026-02-24', 'wow', 'https://static.nationalgeographic.fr/files/styles/image_3200/public/01-solar-system-pia12114_orig.webp?w=1190&h=896', 2), @@ -65,20 +65,50 @@ CREATE TABLE IF NOT EXISTS `gallerie` ( CONSTRAINT `FK_gallerie_evenements` FOREIGN KEY (`event_id`) REFERENCES `evenements` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; --- Listage des données de la table intranet.gallerie : ~12 rows (environ) +-- Listage des données de la table intranet.gallerie : ~41 rows (environ) INSERT INTO `gallerie` (`event_id`, `chemin`, `texte`) VALUES - (3, 'https://www.bigfootdigital.co.uk/wp-content/uploads/2020/07/image-optimisation-scaled.jpg', NULL), - (3, 'https://png.pngtree.com/thumb_back/fh260/background/20240522/pngtree-abstract-cloudy-background-beautiful-natural-streaks-of-sky-and-clouds-red-image_15684333.jpg', NULL), - (1, 'https://images.pexels.com/photos/1090745/pexels-photo-1090745.jpeg?cs=srgb&dl=pexels-elias-tigiser-411757-1090745.jpg&fm=jpg', NULL), - (1, 'https://cdn.pixabay.com/photo/2019/11/06/05/15/bridge-4605202_1280.jpg', NULL), - (1, 'https://images.pexels.com/photos/955658/pexels-photo-955658.jpeg?cs=srgb&dl=pexels-torsten-kellermann-349167-955658.jpg&fm=jpg', NULL), - (1, 'https://hips.hearstapps.com/hmg-prod/images/winding-farm-road-through-foggy-landscape-royalty-free-image-1693423663.jpg?crop=1xw:0.84355xh;center,top', NULL), - (1, 'https://upload.wikimedia.org/wikipedia/commons/7/7d/Morning%2C_just_after_sunrise%2C_Namibia.jpg', NULL), - (1, 'https://media.istockphoto.com/id/467367026/fr/photo/ciel-parfait-et-loc%C3%A9an.jpg?s=612x612&w=0&k=20&c=3UFkx01SwfrzT2-PKEK8W0xcKGKUgzEWeZkBMgvcTuQ=', NULL), - (1, 'https://images.ctfassets.net/hrltx12pl8hq/28ECAQiPJZ78hxatLTa7Ts/2f695d869736ae3b0de3e56ceaca3958/free-nature-images.jpg?fit=fill&w=1200&h=630', NULL), - (3, 'https://lh5.googleusercontent.com/proxy/uBqPxn6KlUBKLda64jI_WVuPH9NBM5YKeVYdDUnnxM76T5vC8epKVjrOH8NUtp2PY7bgLbjrO38ZrNA1G_TIs255ksjq7w', NULL), - (3, 'https://www.guillenphoto.com/data/blog/2020/032-chronique-pourquoi-comment-bonne-photo-I/images/route-vers-monument-valley-en-arizona-amar-guillen-artiste-photographe.jpg', NULL), - (3, 'https://www.expemag.com/media/show/67d43e343f78e626b1efb6cd.jpg', NULL); + (4, 'gallery_4_1772628170_0.JPG', ''), + (4, 'gallery_4_1772628170_1.JPG', ''), + (4, 'gallery_4_1772628170_2.JPG', ''), + (4, 'gallery_4_1772628170_3.JPG', ''), + (4, 'gallery_4_1772628170_4.JPG', ''), + (4, 'gallery_4_1772628170_5.JPG', ''), + (4, 'gallery_4_1772628170_6.JPG', ''), + (4, 'gallery_4_1772628170_7.JPG', ''), + (4, 'gallery_4_1772628170_8.JPG', ''), + (4, 'gallery_4_1772628170_9.JPG', ''), + (4, 'gallery_4_1772628170_10.JPG', ''), + (4, 'gallery_4_1772628170_11.JPG', ''), + (4, 'gallery_4_1772628170_12.JPG', ''), + (4, 'gallery_4_1772628170_13.JPG', ''), + (4, 'gallery_4_1772628170_14.JPG', ''), + (4, 'gallery_4_1772628170_15.JPG', ''), + (4, 'gallery_4_1772628170_16.JPG', ''), + (4, 'gallery_4_1772628170_17.JPG', ''), + (4, 'gallery_4_1772628170_18.JPG', ''), + (4, 'gallery_4_1772628170_19.JPG', ''), + (1, 'gallery_1_1772629484_0.JPG', ''), + (1, 'gallery_1_1772629484_1.JPG', ''), + (1, 'gallery_1_1772629484_2.JPG', ''), + (1, 'gallery_1_1772629484_3.JPG', ''), + (1, 'gallery_1_1772629484_4.JPG', ''), + (1, 'gallery_1_1772629484_5.JPG', ''), + (1, 'gallery_1_1772629484_6.JPG', ''), + (1, 'gallery_1_1772629484_7.JPG', ''), + (1, 'gallery_1_1772629484_8.JPG', ''), + (1, 'gallery_1_1772629484_9.JPG', ''), + (1, 'gallery_1_1772629484_10.JPG', ''), + (1, 'gallery_1_1772629484_11.JPG', ''), + (1, 'gallery_1_1772629484_12.JPG', ''), + (1, 'gallery_1_1772629484_13.JPG', ''), + (1, 'gallery_1_1772629484_14.JPG', ''), + (1, 'gallery_1_1772629484_15.JPG', ''), + (1, 'gallery_1_1772629484_16.JPG', ''), + (1, 'gallery_1_1772629484_17.JPG', ''), + (1, 'gallery_1_1772629484_18.JPG', ''), + (1, 'gallery_1_1772629484_19.JPG', ''), + (1, 'gallery_1_1772629707_0.JPG', ''), + (3, 'gallery_3_1772632151_0.JPG', ''); -- Listage de la structure de table intranet. permissions CREATE TABLE IF NOT EXISTS `permissions` (