mot croise v1

This commit is contained in:
Baptiste Rebillard 2022-06-12 21:45:19 +02:00
parent 1d1fbe7aa1
commit c0a5f12777
2 changed files with 75 additions and 6 deletions

View file

@ -1,9 +1,24 @@
* { main {
text-align: center; text-align: center;
width: 100vw;
} }
.mot_croise { section {
float: left; display: inline-block;
width: 45vw; background-color: rgba(255,255,255,0.3);
aspect-ratio: 425/600;
width: 43vw;
margin: 1vw;
margin-top: 60px;
}
img {
width: 100%;
background-color: white; background-color: white;
}
@media (max-width: 1500px) {
section {
width: 90vw;
}
} }

View file

@ -1,5 +1,32 @@
<?php <?php
ob_start(); // Start reading html ob_start(); // Start reading html
include "script/db.php";
$end = false;
if(isset($_POST['send'])) {
$req = $db->query('SELECT id, name FROM mot_croise');
while($r = $req->fetch()) {
$input[$r['id']] = htmlspecialchars($_POST["input".$r['id']]);
if(htmlspecialchars($_POST["input".$r['id']]) == $r['name']) {
$color[$r['id']] = "green";
} elseif(!empty($_POST["input".$r['id']])) {
$color[$r['id']] = "red";
} else {
$color[$r['id']] = "grey";
}
}
$end = true;
$i = 1;
while($end AND $i <= count($color)) {
if($color[$i] != "green") {
$end = false;
}
$i++;
}
}
?> ?>
<main> <main>
<div class="box-jaune"> <div class="box-jaune">
@ -10,8 +37,35 @@ ob_start(); // Start reading html
<span class="circles circles-top"></span> <span class="circles circles-top"></span>
<span class="circles circles-bottom"></span> <span class="circles circles-bottom"></span>
</div> </div><br>
<img src="assets/img/mot_croise.svg" class="mot_croise"> <section>
<img src="assets/img/mot_croise.svg" class="mot_croise">
</section>
<section>
Tout les mots doivent être indiqués en minuscule, sans accent, sans espaces ni caractères spéciaux.
<form method="POST">
<?php
$req = $db->query('SELECT id FROM mot_croise');
while($r = $req->fetch()) {
?>
<input type="text" name="input<?= $r['id'] ?>" placeholder="<?= $r['id'] ?>" value="<?php if(isset($input[$r['id']])) { echo $input[$r['id']]; } ?>" style="border: 2px solid <?= $color[$r['id']] ?>;"><br>
<?php
}
if($end) {
?>
Franchement GG à vous, choisissez votre équipe ci-dessous pour lui faire remporter les points
<select name="team">
<option value="">Choisissez votre équipe</option>
<option value="pkpeach">PKpeach</option>
<option value="boomario">Boomario</option>
</select>
<?php
}
?>
<input type="submit" name="send" value="Envoyer">
</form>
</section>
</main> </main>
<?php <?php
$infopage = ["", "Cahier de vacances", ob_get_clean(), "", "vacances"]; //relativepath, pagetitle, pagecontent, pagescript | cf structure/template.php ligne 2 à 6 $infopage = ["", "Cahier de vacances", ob_get_clean(), "", "vacances"]; //relativepath, pagetitle, pagecontent, pagescript | cf structure/template.php ligne 2 à 6