Files
web_2025/R3.01/tp/tp1/ex4/index.php
T
Ulysse JARNOUEN DE VILLARTAY a4580652f8 correction-ulysse (#2)
# Correction pour les TP1 TP2 et TP3

Je n'ai pas testé la connexion à la DB pour le moment car je ne peux pas me co sur https://dwarves.iut-fbleau.fr/phpmyadmin

Co-authored-by: JARNOUEN DE VILLARTAY Ulysse (SAFRAN AIRCRAFT ENGINES) <ulysse.jarnouen-de-villartay@safrangroup.com>
Reviewed-on: #2
2026-04-15 15:34:46 +02:00

41 lines
1.0 KiB
PHP

<?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>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>tp1 - ex4</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>
<h5><a href="./">Tirage aléatoire</a></h5>
<article class="is-center">
<img src="./img/<?= $diceImages[$die1] ?>" alt="Dé 1 : <?= $die1 ?>">
<img src="./img/<?= $diceImages[$die2] ?>" alt="Dé 2 : <?= $die2 ?>">
</article>
<h5>Somme = <?= $sum ?></h5>
</main>
</body>
</html>