From 9ab7a6f620148e4fb103f33937e2e45c7b63a7bf Mon Sep 17 00:00:00 2001 From: Michel Tuboeuf Date: Sun, 24 Nov 2024 11:12:55 +0100 Subject: [PATCH] Supprimer pa.php --- pa.php | 188 --------------------------------------------------------- 1 file changed, 188 deletions(-) delete mode 100644 pa.php diff --git a/pa.php b/pa.php deleted file mode 100644 index ca34cd1..0000000 --- a/pa.php +++ /dev/null @@ -1,188 +0,0 @@ - - - - - uniqid(), - 'title' => htmlspecialchars(trim($title)), - 'nombre' => htmlspecialchars(trim($nombre)), - 'description' => htmlspecialchars(trim($description) ?: "Aucun détail supplémentaire fourni."), - 'transport_option' => htmlspecialchars(trim($transportOption)), - 'date' => date('d-m-Y \à\ H:i:s') - ]; - $annonces[] = $annonce; - saveAnnonces($annonces); - return $annonce; -} - -// Afficher toutes les annonces existantes avec le comptage des options de transport -function displayAnnonces() -{ - $annonces = loadAnnonces(); - $totalCovoiturage = 0; - $totalRdv = 0; - - if (empty($annonces)) { - echo "

Aucune personne inscrite pour le moment.

"; - } else { - foreach ($annonces as $annonce) { - echo "
"; - echo "

" . $annonce['title'] . "

"; - if ($annonce['nombre'] > 0) { - echo "

Nombre de personnes : " . $annonce['nombre'] . "

"; - echo "

Option choisie : " . $annonce['transport_option'] . "

"; - - // Incrémenter les totaux en fonction de l'option choisie - if ($annonce['transport_option'] === 'Covoiturage') { - $totalCovoiturage += (int)$annonce['nombre']; - } elseif ($annonce['transport_option'] === 'Rendez-vous départ') { - $totalRdv += (int)$annonce['nombre']; - } - } else { - echo "

Cette personne a indiqué qu'elle ne sera pas présente.

"; - } - echo "

" . $annonce['description'] . "

"; - echo "Publié le " . $annonce['date'] . ""; - echo "

"; - } - - // Afficher les totaux - echo "

Total des participants :

"; - echo "Total rendez-vous pour du covoiturage : " . $totalCovoiturage . "
"; - echo "Total rendez-vous au départ randonnée : " . $totalRdv . "

"; - } -} - -// Gérer l'ajout d'une nouvelle annonce via POST -if ($_SERVER['REQUEST_METHOD'] === 'POST' && !empty($_POST['title'])) { - $nombre = isset($_POST['not_present']) ? 0 : ($_POST['nombre'] ?? 0); - $description = $_POST['description'] ?? ''; - $transportOption = $nombre > 0 ? ($_POST['transport_option'] ?? '') : ''; - - // Validation pour s'assurer que nombre est positif ou nul - if ($nombre > 0 && empty($transportOption)) { - echo "

Veuillez sélectionner une option de transport.

"; - } else { - addAnnonce($_POST['title'], $nombre, $description, $transportOption); - header("Location: " . $_SERVER['PHP_SELF']); - exit; - } -} -?> - - - - - - - - Qui vient - - - - - - - - -

Qui vient... ou pas

- - -
-
-
- -
-

- - - - -
- - - -
-
-

* Champs obligatoires

- - - -
- - -

Liste des participants

- - - - \ No newline at end of file