correction-ulysse #2

Merged
Ulysse JARNOUEN DE VILLARTAY merged 15 commits from jarnouen/web_2025:correction-ulysse into main 2026-04-15 15:34:47 +02:00
2 changed files with 44 additions and 18 deletions
Showing only changes of commit d5c03b6d86 - Show all commits
+6 -5
View File
@@ -1,8 +1,9 @@
<?php <?php
include 'include/controller.php'; include_once 'include/controller.php';
?> ?>
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en">
<html lang="fr">
<head> <head>
<link <link
rel="stylesheet" rel="stylesheet"
@@ -11,14 +12,14 @@ include 'include/controller.php';
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.2/css/all.min.css" integrity="sha512-SnH5WK+bZxgPHs44uWIX+LLJAJ9/2PkPKZ5QiAj6Ta86w+fsb2TkcmfRyVX3pBnMFcV7oQPJkl9QevSCWr3W6A==" crossorigin="anonymous" referrerpolicy="no-referrer" /> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.2/css/all.min.css" integrity="sha512-SnH5WK+bZxgPHs44uWIX+LLJAJ9/2PkPKZ5QiAj6Ta86w+fsb2TkcmfRyVX3pBnMFcV7oQPJkl9QevSCWr3W6A==" crossorigin="anonymous" referrerpolicy="no-referrer" />
<link rel="stylesheet" href="./css/style.css"> <link rel="stylesheet" href="./css/style.css">
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<title></title> <title>Exercice 1</title>
</head> </head>
<body> <body>
<main> <main>
<ul> <ul>
<?php <?php
echo "<li>$prenom $nom</li>"; echo '<li>' . htmlspecialchars($prenom . ' ' . $nom, ENT_QUOTES, 'UTF-8') . '</li>';
echo "<li><i class='fa-brands $icon fa-2x'></i></li>"; echo '<li>' . htmlspecialchars($systeme, ENT_QUOTES, 'UTF-8') . " <i class='fa-brands $icon fa-2x'></i></li>";
?> ?>
</ul> </ul>
</main> </main>
+26 -1
View File
@@ -1,2 +1,27 @@
<?php <?php
// TODO
$nom = '';
$prenom = '';
$systeme = '';
$icon = 'fa-circle-question';
$systemes = [
1 => ['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'];
}
}