From d5c03b6d86641f1da06efb4a15ba8a2fa94aa115 Mon Sep 17 00:00:00 2001 From: "JARNOUEN DE VILLARTAY Ulysse (SAFRAN AIRCRAFT ENGINES)" Date: Thu, 2 Apr 2026 13:57:47 +0200 Subject: [PATCH] ex1 --- R3.01/tp/tp2/ex1/ex1.php | 35 +++++++++++++------------ R3.01/tp/tp2/ex1/include/controller.php | 27 ++++++++++++++++++- 2 files changed, 44 insertions(+), 18 deletions(-) diff --git a/R3.01/tp/tp2/ex1/ex1.php b/R3.01/tp/tp2/ex1/ex1.php index 351ce8a..c28dd0f 100644 --- a/R3.01/tp/tp2/ex1/ex1.php +++ b/R3.01/tp/tp2/ex1/ex1.php @@ -1,26 +1,27 @@ - - + + + - - - - - -
- -
- + + + Exercice 1 + + +
+ +
+ diff --git a/R3.01/tp/tp2/ex1/include/controller.php b/R3.01/tp/tp2/ex1/include/controller.php index d8e50ed..07d5eab 100644 --- a/R3.01/tp/tp2/ex1/include/controller.php +++ b/R3.01/tp/tp2/ex1/include/controller.php @@ -1,2 +1,27 @@ ['nom' => 'Linux', 'icon' => 'fa-linux'], + 2 => ['nom' => 'Windows', 'icon' => 'fa-windows'], + 3 => ['nom' => 'macOS', 'icon' => 'fa-apple'], + 4 => ['nom' => 'Android', 'icon' => 'fa-android'], +]; + +if ($_SERVER['REQUEST_METHOD'] === 'POST') { + $nomSaisi = trim((string) filter_input(INPUT_POST, 'nom', FILTER_UNSAFE_RAW)); + $prenomSaisi = trim((string) filter_input(INPUT_POST, 'prenom', FILTER_UNSAFE_RAW)); + $os = filter_input(INPUT_POST, 'os', FILTER_VALIDATE_INT); + + $nom = ucfirst(strtolower($nomSaisi)); + $prenom = ucfirst(strtolower($prenomSaisi)); + + if (isset($systemes[$os])) { + $systeme = $systemes[$os]['nom']; + $icon = $systemes[$os]['icon']; + } +}