2020-09-19 16:08:07 +02:00
< ? php
ob_start (); // Start reading html
2022-06-12 21:45:19 +02:00
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 ++ ;
}
}
2020-09-19 16:08:07 +02:00
?>
2022-06-12 16:12:39 +02:00
< main >
< div class = " box-jaune " >
< span class = " corners corners-top " ></ span >
< span class = " corners corners-bottom " ></ span >
2020-09-19 16:08:07 +02:00
2022-06-12 16:12:39 +02:00
< div class = " title " > Mots croisés pour vous occuper pendant les vacances </ div >
< span class = " circles circles-top " ></ span >
< span class = " circles circles-bottom " ></ span >
2022-06-12 21:45:19 +02:00
</ div >< br >
< 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 >
2022-06-12 16:12:39 +02:00
</ main >
2020-09-19 16:08:07 +02:00
< ? php
2022-01-19 22:26:58 +01:00
$infopage = [ " " , " Cahier de vacances " , ob_get_clean (), " " , " vacances " ]; //relativepath, pagetitle, pagecontent, pagescript | cf structure/template.php ligne 2 à 6
include ( " structure/template.php " );
2020-09-19 16:08:07 +02:00
?>