forked from monnerat/web_2025
add correction
This commit is contained in:
parent
eb2d8315f9
commit
6dd596e7b3
@@ -1,9 +1,9 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body>
|
||||
<?php
|
||||
echo "<h1>hello world !!!</h1>";
|
||||
//phpinfo();
|
||||
?>
|
||||
</body>
|
||||
<body>
|
||||
<?php
|
||||
echo "<h1>hello world !!!</h1>";
|
||||
phpinfo();
|
||||
?>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
+35
-10
@@ -1,17 +1,19 @@
|
||||
<?php
|
||||
$clients = [
|
||||
"Luc",
|
||||
7 => "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 "</pre>";
|
||||
|
||||
// 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 "<p>";
|
||||
for ($i = $debut; $i < $debut + 10; $i++) {
|
||||
if ($i % 2 === 0) {
|
||||
echo "<strong>$i</strong> ";
|
||||
} else {
|
||||
echo "<em>$i</em> ";
|
||||
}
|
||||
}
|
||||
echo "</p>";
|
||||
}
|
||||
?>
|
||||
|
||||
+48
-31
@@ -3,36 +3,53 @@ include './include/data.inc.php';
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>tp1 - ex3</title>
|
||||
<link
|
||||
rel="stylesheet"
|
||||
href="https://cdn.jsdelivr.net/npm/@picocss/pico@2/css/pico.classless.min.css"
|
||||
>
|
||||
<link rel="stylesheet" href="./css/style.css">
|
||||
</head>
|
||||
<body>
|
||||
<main>
|
||||
<h2>Exercice 3 : IMC </h2>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Nom</th>
|
||||
<th>Prénom</th>
|
||||
<th>Email</th>
|
||||
<th>Taille</th>
|
||||
<th>Poids</th>
|
||||
<th>IMC</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>tp1 - ex3</title>
|
||||
<link
|
||||
rel="stylesheet"
|
||||
href="https://cdn.jsdelivr.net/npm/@picocss/pico@2/css/pico.classless.min.css"
|
||||
>
|
||||
<link rel="stylesheet" href="./css/style.css">
|
||||
</head>
|
||||
<body>
|
||||
<main>
|
||||
<h2>Exercice 3 : IMC </h2>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Nom</th>
|
||||
<th>Prénom</th>
|
||||
<th>Email</th>
|
||||
<th>Taille</th>
|
||||
<th>Poids</th>
|
||||
<th>IMC</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php include_once './include/data.inc.php'; ?>
|
||||
<?php foreach ($data as $person) : ?>
|
||||
<?php
|
||||
$poids = (float) $person['Poids'];
|
||||
$tailleM = (float) $person['Taille'] / 100;
|
||||
|
||||
<!-- À compléter -->
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</main>
|
||||
</body>
|
||||
$imc = null;
|
||||
if ($tailleM > 0) {
|
||||
$imc = $poids / ($tailleM * $tailleM);
|
||||
}
|
||||
?>
|
||||
<tr class="<?= $imc < 18.5 ? 'underweight' : ($imc < 25 ? 'normal' : 'warning') ?>">
|
||||
<td><?= $person['Nom'] ?></td>
|
||||
<td><?= $person['Prenom'] ?></td>
|
||||
<td><?= $person['Email'] ?></td>
|
||||
<td><?= $person['Taille'] ?></td>
|
||||
<td><?= $person['Poids'] ?></td>
|
||||
<td><?= round($imc, 2) ?></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,3 +1,19 @@
|
||||
<?php
|
||||
// Generate random values for two six-sided dice.
|
||||
$die1 = mt_rand(1, 6);
|
||||
$die2 = mt_rand(1, 6);
|
||||
$sum = $die1 + $die2;
|
||||
|
||||
// Map dice values to matching SVG filenames.
|
||||
$diceImages = [
|
||||
1 => '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',
|
||||
];
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
@@ -13,12 +29,12 @@
|
||||
</head>
|
||||
<body>
|
||||
<main>
|
||||
<h5><a href=""> Tirage aléatoire</a></h5>
|
||||
<h5><a href="./">Tirage aléatoire</a></h5>
|
||||
<article class="is-center">
|
||||
<img src='./img/dice-six-faces-five.svg'>
|
||||
<img src='./img/dice-six-faces-one.svg'>
|
||||
<img src="./img/<?= $diceImages[$die1] ?>" alt="Dé 1 : <?= $die1 ?>">
|
||||
<img src="./img/<?= $diceImages[$die2] ?>" alt="Dé 2 : <?= $die2 ?>">
|
||||
</article>
|
||||
<h5>Somme = </h5>
|
||||
<h5>Somme = <?= $sum ?></h5>
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
function createPassword($n,$alphabet){
|
||||
$length = strlen($alphabet);
|
||||
$password = "";
|
||||
return $password;
|
||||
function createPassword($n,$alphabet) {
|
||||
$length = strlen($alphabet);
|
||||
$password = "";
|
||||
return $password;
|
||||
}
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user