From 6dd596e7b35e2eafc090eea25c5498e98a1fc6ae Mon Sep 17 00:00:00 2001 From: "JARNOUEN DE VILLARTAY Ulysse (SAFRAN AIRCRAFT ENGINES)" Date: Thu, 2 Apr 2026 13:48:28 +0200 Subject: [PATCH 01/12] add correction --- R3.01/tp/tp1/ex1/hello-world.php | 12 ++-- R3.01/tp/tp1/ex2/index.php | 45 +++++++++++---- R3.01/tp/tp1/ex3/index.php | 79 ++++++++++++++++----------- R3.01/tp/tp1/ex4/index.php | 24 ++++++-- R3.01/tp/tp1/ex6/include/fonction.php | 8 +-- 5 files changed, 113 insertions(+), 55 deletions(-) diff --git a/R3.01/tp/tp1/ex1/hello-world.php b/R3.01/tp/tp1/ex1/hello-world.php index 11a784f..183c053 100644 --- a/R3.01/tp/tp1/ex1/hello-world.php +++ b/R3.01/tp/tp1/ex1/hello-world.php @@ -1,9 +1,9 @@ - - hello world !!!"; - //phpinfo(); - ?> - + + hello world !!!"; + phpinfo(); + ?> + diff --git a/R3.01/tp/tp1/ex2/index.php b/R3.01/tp/tp1/ex2/index.php index 90e8baa..83fc42a 100644 --- a/R3.01/tp/tp1/ex2/index.php +++ b/R3.01/tp/tp1/ex2/index.php @@ -1,17 +1,19 @@ "Paul", - 2 =>"Martin", - "Arnaud" +$clients = [ + "Luc", + 7 => "Paul", + 2 =>"Martin", + "Arnaud" ]; +var_dump($clients); + $produits = [ - 20 => "Chemise", - 3 => "Pantalon", - 10 => "Jupe", - "Veste", - "Blouson" + 20 => "Chemise", + 3 => "Pantalon", + 10 => "Jupe", + "Veste", + "Blouson" ]; $array = ["a","b","c"]; $array[] = "d"; @@ -23,4 +25,27 @@ print_r($clients); print_r($produits); print_r($array); echo ""; + +// Exercice 2.1 +$tab = []; +$somme = 0; +for ($i = 0; $i < 10; $i++) { + $somme += $i; // somme des entiers de 0 à i + $tab[$i] = $somme; // la clé i contient cette somme +} +print_r($tab); + + +// Exercice 2.2 +for ($debut = 1; $debut <= 50; $debut += 10) { + echo "

"; + for ($i = $debut; $i < $debut + 10; $i++) { + if ($i % 2 === 0) { + echo "$i "; + } else { + echo "$i "; + } + } + echo "

"; +} ?> diff --git a/R3.01/tp/tp1/ex3/index.php b/R3.01/tp/tp1/ex3/index.php index f031367..55f0ee4 100644 --- a/R3.01/tp/tp1/ex3/index.php +++ b/R3.01/tp/tp1/ex3/index.php @@ -3,36 +3,53 @@ include './include/data.inc.php'; ?> - - - - tp1 - ex3 - - - - -
-

Exercice 3 : IMC

- - - - - - - - - - - - + + + + tp1 - ex3 + + + + +
+

Exercice 3 : IMC

+
NomPrénomEmailTaillePoidsIMC
+ + + + + + + + + + + + + + - - -
NomPrénomEmailTaillePoidsIMC
-
- + $imc = null; + if ($tailleM > 0) { + $imc = $poids / ($tailleM * $tailleM); + } + ?> + + + + + + + + + + + + + diff --git a/R3.01/tp/tp1/ex4/index.php b/R3.01/tp/tp1/ex4/index.php index 1db7b37..18c1bbf 100644 --- a/R3.01/tp/tp1/ex4/index.php +++ b/R3.01/tp/tp1/ex4/index.php @@ -1,3 +1,19 @@ + 'dice-six-faces-one.svg', + 2 => 'dice-six-faces-two.svg', + 3 => 'dice-six-faces-three.svg', + 4 => 'dice-six-faces-four.svg', + 5 => 'dice-six-faces-five.svg', + 6 => 'dice-six-faces-six.svg', +]; +?> @@ -13,12 +29,12 @@
-
Tirage aléatoire
+
Tirage aléatoire
- - + Dé 1 : <?= $die1 ?> + Dé 2 : <?= $die2 ?>
-
Somme =
+
Somme =
diff --git a/R3.01/tp/tp1/ex6/include/fonction.php b/R3.01/tp/tp1/ex6/include/fonction.php index 10aaf04..2c0856b 100644 --- a/R3.01/tp/tp1/ex6/include/fonction.php +++ b/R3.01/tp/tp1/ex6/include/fonction.php @@ -1,7 +1,7 @@ -- 2.54.0 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 02/12] 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 @@ - - + + + - - - - - -
-
    - $prenom $nom"; - echo "
  • "; - ?> -
-
- + + + Exercice 1 + + +
+
    + ' . htmlspecialchars($prenom . ' ' . $nom, ENT_QUOTES, 'UTF-8') . ''; + echo '
  • ' . htmlspecialchars($systeme, ENT_QUOTES, 'UTF-8') . "
  • "; + ?> +
+
+ 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']; + } +} -- 2.54.0 From d82343a051e4b0bca5116cf5e6a3d08bebbc44b9 Mon Sep 17 00:00:00 2001 From: "JARNOUEN DE VILLARTAY Ulysse (SAFRAN AIRCRAFT ENGINES)" Date: Thu, 2 Apr 2026 14:41:53 +0200 Subject: [PATCH 03/12] ex2 --- R3.01/tp/tp2/ex2/include/controller.php | 21 ++++++++- R3.01/tp/tp2/ex2/multiplication.php | 62 +++++++++++++++++-------- 2 files changed, 63 insertions(+), 20 deletions(-) diff --git a/R3.01/tp/tp2/ex2/include/controller.php b/R3.01/tp/tp2/ex2/include/controller.php index d8e50ed..856983e 100644 --- a/R3.01/tp/tp2/ex2/include/controller.php +++ b/R3.01/tp/tp2/ex2/include/controller.php @@ -1,2 +1,21 @@ $multiplicateur, + 'resultat' => $table * $multiplicateur, + ]; + } + } +} diff --git a/R3.01/tp/tp2/ex2/multiplication.php b/R3.01/tp/tp2/ex2/multiplication.php index ef95e58..8d26872 100644 --- a/R3.01/tp/tp2/ex2/multiplication.php +++ b/R3.01/tp/tp2/ex2/multiplication.php @@ -1,23 +1,47 @@ - - - - - - - -
-

Table de multiplication

-
- - -
-
- + + + + + + Exercice 2 + + +
+

Table de multiplication

+
+ + +
+ + +

+ + + +
    + +
  • + + x + + = + +
  • + +
+ +
+ -- 2.54.0 From ca49c90ffa4a5466889e3f70da56137e2595c5b9 Mon Sep 17 00:00:00 2001 From: "JARNOUEN DE VILLARTAY Ulysse (SAFRAN AIRCRAFT ENGINES)" Date: Thu, 2 Apr 2026 14:42:06 +0200 Subject: [PATCH 04/12] ex3 --- R3.01/tp/tp2/ex3/calculatrice.php | 81 ++++++++++++++++--------- R3.01/tp/tp2/ex3/include/controller.php | 56 ++++++++++++++++- 2 files changed, 108 insertions(+), 29 deletions(-) diff --git a/R3.01/tp/tp2/ex3/calculatrice.php b/R3.01/tp/tp2/ex3/calculatrice.php index 5b9b228..2796fd1 100644 --- a/R3.01/tp/tp2/ex3/calculatrice.php +++ b/R3.01/tp/tp2/ex3/calculatrice.php @@ -1,34 +1,59 @@ - - - - - - - -
-

Calculatrice

-
-
- - - - - - -
- + + + Exercice 3 + + + + +
+

Calculatrice

+
+
+ + + + +
+
+ + +

+ + + +

+ Résultat : + +

+ +
+ diff --git a/R3.01/tp/tp2/ex3/include/controller.php b/R3.01/tp/tp2/ex3/include/controller.php index e8fd322..266ba36 100644 --- a/R3.01/tp/tp2/ex3/include/controller.php +++ b/R3.01/tp/tp2/ex3/include/controller.php @@ -1,2 +1,56 @@ Date: Thu, 2 Apr 2026 14:42:16 +0200 Subject: [PATCH 05/12] ex4 --- R3.01/tp/tp2/ex4/css/style.css | 10 ++++ R3.01/tp/tp2/ex4/score.php | 94 ++++++++++++++++++++++++++++------ 2 files changed, 89 insertions(+), 15 deletions(-) diff --git a/R3.01/tp/tp2/ex4/css/style.css b/R3.01/tp/tp2/ex4/css/style.css index 45f71e9..3cd0ec4 100644 --- a/R3.01/tp/tp2/ex4/css/style.css +++ b/R3.01/tp/tp2/ex4/css/style.css @@ -2,3 +2,13 @@ button{ float:right; } + +.bonne-reponse { + color: #1b7f3a; + font-weight: 700; +} + +.mauvaise-reponse { + color: #c62828; + font-weight: 700; +} diff --git a/R3.01/tp/tp2/ex4/score.php b/R3.01/tp/tp2/ex4/score.php index 30876c4..4febf98 100644 --- a/R3.01/tp/tp2/ex4/score.php +++ b/R3.01/tp/tp2/ex4/score.php @@ -1,17 +1,81 @@ + $index, + 'classe' => 'bonne-reponse', + 'message' => 'Bonne reponse', + ]; + } else { + $resultatsParQuestion[] = [ + 'numero' => $index, + 'classe' => 'mauvaise-reponse', + 'message' => 'Mauvaise reponse', + ]; + } + } +} +?> - - - - - - - -
-

Réponses

- -
- + + + + + + Exercice 4 + + +
+

Resultat du quizz

+ +

+ +

+ Vous avez obtenu + + bonne(s) reponse(s) sur + . +

+

+ Questions repondues : + . +

+
    + +
  • + Question : + + + +
  • + +
+ +

+ Revenir au quizz +

+
+ -- 2.54.0 From 11386eed58a88e33badb1e90cac114b46c24896a Mon Sep 17 00:00:00 2001 From: "JARNOUEN DE VILLARTAY Ulysse (SAFRAN AIRCRAFT ENGINES)" Date: Thu, 2 Apr 2026 14:42:35 +0200 Subject: [PATCH 06/12] ex5 --- R3.01/tp/tp2/ex5/conjuguer.php | 52 ++++++++++++++------ R3.01/tp/tp2/ex5/include/controller.php | 64 ++++++++++++++++++++++--- 2 files changed, 95 insertions(+), 21 deletions(-) diff --git a/R3.01/tp/tp2/ex5/conjuguer.php b/R3.01/tp/tp2/ex5/conjuguer.php index 507d322..e51405d 100644 --- a/R3.01/tp/tp2/ex5/conjuguer.php +++ b/R3.01/tp/tp2/ex5/conjuguer.php @@ -1,23 +1,45 @@ - - - - - + + + + + + Exercice 5 + + +
+

Conjugaison

- - - -
+ +

+ +

+ Verbe : + +

-
- + +
+

+
    + +
  • + +
+
+ + +

+ Retour au formulaire +

+
+ diff --git a/R3.01/tp/tp2/ex5/include/controller.php b/R3.01/tp/tp2/ex5/include/controller.php index f35c02d..f1f8309 100644 --- a/R3.01/tp/tp2/ex5/include/controller.php +++ b/R3.01/tp/tp2/ex5/include/controller.php @@ -1,12 +1,64 @@ array("e","es","e","ons","ez","ent"), - "futur"=>array("erai","eras","era","erons","erez","eront"), - "imparfait"=>array("ais","ais","ait","ions","iez","aient") + 'present' => array('e', 'es', 'e', 'ons', 'ez', 'ent'), + 'futur' => array('erai', 'eras', 'era', 'erons', 'erez', 'eront'), + 'imparfait' => array('ais', 'ais', 'ait', 'ions', 'iez', 'aient') ); -$pronoms=array("je","tu","il","nous","vous","ils"); +$libellesTemps = array( + 'present' => 'Present', + 'futur' => 'Futur', + 'imparfait' => 'Imparfait' +); -$verbe = filter_input(INPUT_POST,"verbe",FILTER_SANITIZE_STRING); -$radical = substr($verbe,0,strlen($verbe)-2); +$pronoms = array('je', 'tu', 'il', 'nous', 'vous', 'ils'); + +$verbeSaisi = filter_input(INPUT_POST, 'verbe', FILTER_UNSAFE_RAW); +$verbeSaisi = is_string($verbeSaisi) ? trim($verbeSaisi) : ''; +$verbe = strtolower($verbeSaisi); + +$tempsChoisis = filter_input(INPUT_POST, 'temps', FILTER_DEFAULT, FILTER_REQUIRE_ARRAY); +$tempsChoisis = is_array($tempsChoisis) ? $tempsChoisis : array(); + +$messageErreur = ''; +$conjugaisons = array(); + +if ($_SERVER['REQUEST_METHOD'] === 'POST') { + if ($verbe === '') { + $messageErreur = 'Veuillez saisir un verbe.'; + } elseif (strlen($verbe) < 3 || substr($verbe, -2) !== 'er') { + $messageErreur = 'Veuillez saisir un verbe du premier groupe.'; + } elseif ($tempsChoisis === array()) { + $messageErreur = 'Veuillez choisir au moins un temps.'; + } else { + $radical = substr($verbe, 0, strlen($verbe) - 2); + + foreach ($tempsChoisis as $temps) { + if (!isset($terminaisons[$temps], $libellesTemps[$temps])) { + continue; + } + + $formes = array(); + + foreach ($pronoms as $index => $pronom) { + $forme = $radical . $terminaisons[$temps][$index]; + + if ($pronom === 'je' && preg_match('/^[aeiouh]/', $forme) === 1) { + $formes[] = "j'" . $forme; + } else { + $formes[] = $pronom . ' ' . $forme; + } + } + + $conjugaisons[] = array( + 'temps' => $libellesTemps[$temps], + 'formes' => $formes + ); + } + + if ($conjugaisons === array()) { + $messageErreur = 'Aucun temps valide n a ete transmis.'; + } + } +} -- 2.54.0 From cf7a51459c52f5837fea16b1394d6a3fdb63cb52 Mon Sep 17 00:00:00 2001 From: "JARNOUEN DE VILLARTAY Ulysse (SAFRAN AIRCRAFT ENGINES)" Date: Wed, 8 Apr 2026 16:10:35 +0200 Subject: [PATCH 07/12] correction ex1 --- R3.01/tp/tp3/chifoumi/css/style.css | 3 +++ R3.01/tp/tp3/chifoumi/index.php | 41 ++++++++++++++++++----------- 2 files changed, 29 insertions(+), 15 deletions(-) diff --git a/R3.01/tp/tp3/chifoumi/css/style.css b/R3.01/tp/tp3/chifoumi/css/style.css index 51fbf56..cd05b20 100644 --- a/R3.01/tp/tp3/chifoumi/css/style.css +++ b/R3.01/tp/tp3/chifoumi/css/style.css @@ -8,3 +8,6 @@ color:#2E8B57; .Loss{ color:#FF6347; } +.Draw{ +color:#DAA520; +} diff --git a/R3.01/tp/tp3/chifoumi/index.php b/R3.01/tp/tp3/chifoumi/index.php index 7845b33..6045fd4 100644 --- a/R3.01/tp/tp3/chifoumi/index.php +++ b/R3.01/tp/tp3/chifoumi/index.php @@ -1,20 +1,31 @@ [0 => "Draw", 1 => "Loss", 2 => "Win"], + 1 => [0 => "Win", 1 => "Draw", 2 => "Loss"], + 2 => [0 => "Loss", 1 => "Win", 2 => "Draw"], +]; -$playerChoice = 0; -$computerChoice = 1; +$playerChoice = filter_input( + INPUT_GET, + 'choice', + FILTER_VALIDATE_INT, + ['options' => ['min_range' => 0, 'max_range' => 2]] +); -$message = "Win"; -$class = "Win"; +$isPlaying = ($playerChoice !== null && $playerChoice !== false); -$imagePlayer = $images[$playerChoice]; -$imageComputer = $images[$computerChoice]; - -include './views/header.php'; -if ($isPlaying){ - include './views/game.php'; - include './views/message.php'; +if ($isPlaying) { + $computerChoice = mt_rand(0, 2); + $message = $rules[$playerChoice][$computerChoice]; + $class = $message; + $imagePlayer = $images[$playerChoice]; + $imageComputer = $images[$computerChoice]; } -include './views/footer.php'; -?> + +include_once './views/header.php'; +if ($isPlaying) { + include_once './views/game.php'; + include_once './views/message.php'; +} +include_once './views/footer.php'; -- 2.54.0 From 09e55a2b284d65b3af8bf3638cef9e8ca857d268 Mon Sep 17 00:00:00 2001 From: "JARNOUEN DE VILLARTAY Ulysse (SAFRAN AIRCRAFT ENGINES)" Date: Wed, 8 Apr 2026 16:10:49 +0200 Subject: [PATCH 08/12] correction ex2 --- R3.01/tp/tp3/cinema/src/films.php | 37 +++++++-- .../tp/tp3/cinema/src/modeles/modeleFilms.php | 72 +++++++++++++++--- R3.01/tp/tp3/cinema/src/vues/vueFilms.php | 76 +++++++++++++------ 3 files changed, 146 insertions(+), 39 deletions(-) diff --git a/R3.01/tp/tp3/cinema/src/films.php b/R3.01/tp/tp3/cinema/src/films.php index b9563da..f85002d 100644 --- a/R3.01/tp/tp3/cinema/src/films.php +++ b/R3.01/tp/tp3/cinema/src/films.php @@ -1,14 +1,37 @@ ['min_range' => 1]] +); + +if ($currentPage === null || $currentPage === false) { + $currentPage = 1; +} + +$perPage = 10; +$data = getFilms($currentPage, $perPage); +$films = $data['films']; +$errorMessage = $data['error']; +$totalFilms = $data['total']; +$totalPages = max(1, (int) ceil($totalFilms / $perPage)); + +if ($currentPage > $totalPages && $totalFilms > 0) { + $currentPage = $totalPages; + $data = getFilms($currentPage, $perPage); + $films = $data['films']; + $errorMessage = $data['error']; + $totalFilms = $data['total']; +} // -// on "charge" la vue +// on "charge" la vue // -include './vues/header.php'; -include './vues/vueFilms.php'; -include './vues/footer.php'; -?> +include_once './vues/header.php'; +include_once './vues/vueFilms.php'; +include_once './vues/footer.php'; diff --git a/R3.01/tp/tp3/cinema/src/modeles/modeleFilms.php b/R3.01/tp/tp3/cinema/src/modeles/modeleFilms.php index 1ca9f2e..0fce5de 100644 --- a/R3.01/tp/tp3/cinema/src/modeles/modeleFilms.php +++ b/R3.01/tp/tp3/cinema/src/modeles/modeleFilms.php @@ -1,16 +1,68 @@ [], + 'total' => 0, + 'error' => 'Connexion MySQL impossible.', + ]; + } + + $page = max(1, (int) $page); + $perPage = max(1, (int) $perPage); + $offset = ($page - 1) * $perPage; + + $sql = "SELECT SQL_CALC_FOUND_ROWS + F.idFilm, + F.titre, + F.annee, + G.code AS genre, + A.prenom, + A.nom + FROM Film AS F + INNER JOIN Artiste AS A ON F.idMes = A.idArtiste + INNER JOIN Genre AS G ON F.genre = G.code + ORDER BY F.titre ASC + LIMIT {$offset}, {$perPage}"; + + $result = mysqli_query($conn, $sql); + if ($result === false) { + return [ + 'films' => [], + 'total' => 0, + 'error' => 'Exécution de la requête impossible.', + ]; + } + + $films = mysqli_fetch_all($result, MYSQLI_ASSOC); + + $totalResult = mysqli_query($conn, 'SELECT FOUND_ROWS() AS total'); + $totalRow = $totalResult ? mysqli_fetch_assoc($totalResult) : ['total' => 0]; + $total = isset($totalRow['total']) ? (int) $totalRow['total'] : 0; + + return [ + 'films' => $films, + 'total' => $total, + 'error' => null, + ]; } -?> diff --git a/R3.01/tp/tp3/cinema/src/vues/vueFilms.php b/R3.01/tp/tp3/cinema/src/vues/vueFilms.php index 6d40687..93f70dd 100644 --- a/R3.01/tp/tp3/cinema/src/vues/vueFilms.php +++ b/R3.01/tp/tp3/cinema/src/vues/vueFilms.php @@ -1,32 +1,64 @@ -

Films

+ +
+ - - - - - - - - - + + + + + + + + + - - - - - "; +foreach ($films as $film) { + $titre = htmlspecialchars($film['titre'], ENT_QUOTES, 'UTF-8'); + $annee = htmlspecialchars((string) $film['annee'], ENT_QUOTES, 'UTF-8'); + $genre = htmlspecialchars($film['genre'], ENT_QUOTES, 'UTF-8'); + $realisateur = htmlspecialchars($film['prenom'] . ' ' . $film['nom'], ENT_QUOTES, 'UTF-8'); + echo " + + + + + + "; } ?> - +
TitreAnnéeGenreRéalisateur
TitreAnnéeGenreRéalisateur
{$film['titre']}{$film['annee']}{$film['genre']}{$film['prenom']} {$film['nom']}
{$titre}{$annee}{$genre}{$realisateur}
+ 1) { ?> + + + -- 2.54.0 From 5dad31182787c3578012b0f9e331b44820244c6a Mon Sep 17 00:00:00 2001 From: "JARNOUEN DE VILLARTAY Ulysse (SAFRAN AIRCRAFT ENGINES)" Date: Wed, 8 Apr 2026 16:36:35 +0200 Subject: [PATCH 09/12] use include_once --- R3.01/tp/tp1/ex3/index.php | 2 +- R3.01/tp/tp1/ex5/index.php | 4 ++-- R3.01/tp/tp1/ex6/index.php | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/R3.01/tp/tp1/ex3/index.php b/R3.01/tp/tp1/ex3/index.php index 55f0ee4..1dd90cd 100644 --- a/R3.01/tp/tp1/ex3/index.php +++ b/R3.01/tp/tp1/ex3/index.php @@ -1,5 +1,5 @@ diff --git a/R3.01/tp/tp1/ex5/index.php b/R3.01/tp/tp1/ex5/index.php index 2fa8b9b..d37bc41 100644 --- a/R3.01/tp/tp1/ex5/index.php +++ b/R3.01/tp/tp1/ex5/index.php @@ -1,5 +1,5 @@ @@ -17,7 +17,7 @@ include './include/favoris.inc.php';

- Exercice 4 : Favoris + Exercice 4 : Favoris

diff --git a/R3.01/tp/tp1/ex6/index.php b/R3.01/tp/tp1/ex6/index.php index b0fd03c..ee47f8d 100644 --- a/R3.01/tp/tp1/ex6/index.php +++ b/R3.01/tp/tp1/ex6/index.php @@ -1,5 +1,5 @@ -- 2.54.0 From bdc3e430b6a84d35155f758f92d4cce7a50426a3 Mon Sep 17 00:00:00 2001 From: "JARNOUEN DE VILLARTAY Ulysse (SAFRAN AIRCRAFT ENGINES)" Date: Wed, 8 Apr 2026 16:46:46 +0200 Subject: [PATCH 10/12] get db host url from env --- R3.01/tp/tp3/cinema/src/modeles/modeleFilms.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/R3.01/tp/tp3/cinema/src/modeles/modeleFilms.php b/R3.01/tp/tp3/cinema/src/modeles/modeleFilms.php index 0fce5de..34e9e25 100644 --- a/R3.01/tp/tp3/cinema/src/modeles/modeleFilms.php +++ b/R3.01/tp/tp3/cinema/src/modeles/modeleFilms.php @@ -4,10 +4,11 @@ function getConnection() static $conn = null; if ($conn === null) { - $login = getenv('DB_USER') ?: getenv('USER') ?: getenv('USERNAME') ?: 's576807'; + $host = getenv('DB_HOST') ?: 'https://dwarves.iut-fbleau.fr'; + $login = getenv('DB_USER') ?: getenv('USER') ?: getenv('USERNAME') ?: 'root'; $password = getenv('DB_PASSWORD') ?: $login; $database = getenv('DB_NAME') ?: $login; - $conn = mysqli_connect('localhost', $login, $password, $database); + $conn = mysqli_connect($host, $login, $password, $database); if ($conn !== false) { mysqli_set_charset($conn, 'utf8mb4'); -- 2.54.0 From 43b5ee3521c5857f21d72834a6ce64b01b79f6d6 Mon Sep 17 00:00:00 2001 From: "JARNOUEN DE VILLARTAY Ulysse (SAFRAN AIRCRAFT ENGINES)" Date: Wed, 8 Apr 2026 17:01:41 +0200 Subject: [PATCH 11/12] fix: remove useless code --- R3.01/tp/tp2/ex2/include/controller.php | 21 +++++++++------------ R3.01/tp/tp2/ex2/multiplication.php | 2 +- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/R3.01/tp/tp2/ex2/include/controller.php b/R3.01/tp/tp2/ex2/include/controller.php index 856983e..d0752bb 100644 --- a/R3.01/tp/tp2/ex2/include/controller.php +++ b/R3.01/tp/tp2/ex2/include/controller.php @@ -1,21 +1,18 @@ $multiplicateur, - 'resultat' => $table * $multiplicateur, - ]; - } +if ($table === false || $table === null) { + $messageErreur = 'Veuillez saisir un entier valide.'; +} else { + for ($multiplicateur = 1; $multiplicateur <= 10; $multiplicateur++) { + $lignes[] = [ + 'multiplicateur' => $multiplicateur, + 'resultat' => $table * $multiplicateur, + ]; } } + diff --git a/R3.01/tp/tp2/ex2/multiplication.php b/R3.01/tp/tp2/ex2/multiplication.php index 8d26872..96c39d9 100644 --- a/R3.01/tp/tp2/ex2/multiplication.php +++ b/R3.01/tp/tp2/ex2/multiplication.php @@ -20,7 +20,7 @@ include_once 'include/controller.php'; type="number" name="table" placeholder="table" - value="" + value="" > -- 2.54.0 From 1dcd20de8511c527e4821d3ea64f36da69cfa2e4 Mon Sep 17 00:00:00 2001 From: "JARNOUEN DE VILLARTAY Ulysse (SAFRAN AIRCRAFT ENGINES)" Date: Wed, 8 Apr 2026 17:13:19 +0200 Subject: [PATCH 12/12] use constants for rock paper scissors --- R3.01/tp/tp3/chifoumi/index.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/R3.01/tp/tp3/chifoumi/index.php b/R3.01/tp/tp3/chifoumi/index.php index 6045fd4..7df181a 100644 --- a/R3.01/tp/tp3/chifoumi/index.php +++ b/R3.01/tp/tp3/chifoumi/index.php @@ -1,9 +1,13 @@ [0 => "Draw", 1 => "Loss", 2 => "Win"], - 1 => [0 => "Win", 1 => "Draw", 2 => "Loss"], - 2 => [0 => "Loss", 1 => "Win", 2 => "Draw"], + $ROCK => [$ROCK => "Draw", $PAPER => "Loss", $SCISSORS => "Win"], + $PAPER => [$ROCK => "Win", $PAPER => "Draw", $SCISSORS => "Loss"], + $SCISSORS => [$ROCK => "Loss", $PAPER => "Win", $SCISSORS => "Draw"], ]; $playerChoice = filter_input( -- 2.54.0