2020-09-19 16:08:07 +02:00
< ? php
ob_start (); // Start reading html
2022-06-14 02:23:05 +02:00
include " script/db.php " ;
2022-06-12 21:45:19 +02:00
2023-04-22 18:47:14 +02:00
include " assets/scripts/globals.php " ;
2023-01-26 15:53:45 +01:00
2022-06-12 21:45:19 +02:00
2023-06-22 17:30:50 +02:00
// on vérifie l'envoi d'une réponse
if ( isset ( $_POST [ " team " ])){
$req = $db -> prepare ( " SELECT * FROM mots_croise WHERE name=? AND id=? AND trouve=? " );
$req -> execute ( array ( htmlspecialchars ( $_POST [ " mot " ]),( int ) $_POST [ " id_mot " ], FALSE ));
$mot_exist = $req -> rowCount ();
if ( $mot_exist == 1 ) {
if ( ! empty ( $_POST [ 'team' ])) {
$team = htmlspecialchars ( $_POST [ 'team' ]);
if ( $team == $TEAM1 ) {
$team = 0 ;
} elseif ( $team == $TEAM2 ) {
$team = 1 ;
} else {
header ( 'Refresh: 0' );
}
//ajoute des points au score général
$req = $db -> prepare ( " INSERT INTO scores(texte, points, team, id_staff) VALUES(?, ?, ?, ?) " );
$req -> execute ( array ( " Mots croises " , " 500 " , $team , 0 ));
2022-06-12 21:45:19 +02:00
2023-06-22 17:30:50 +02:00
// maj la valeur de trouve a TRUE
$req = $db -> prepare ( " UPDATE mots_croise SET trouve=? WHERE name=? " );
$req -> execute ( array ( TRUE , htmlspecialchars ( $_POST [ " mot " ])));
?> <script type="text/javascript">alert("Félicitation, vous avez fait gagner 500 points à votre équipe !!");</script><?php
2022-06-12 21:45:19 +02:00
}
2023-08-03 12:39:42 +02:00
2023-06-22 17:30:50 +02:00
} else {
2023-08-03 12:39:42 +02:00
// on teste quand meme si le mot a ete trouve pour afficher un message contextuel
$req = $db -> prepare ( " SELECT * FROM mots_croise WHERE name=? AND id=? AND trouve=? " );
$req -> execute ( array ( htmlspecialchars ( $_POST [ " mot " ]),( int ) $_POST [ " id_mot " ], TRUE ));
$mot_exist = $req -> rowCount ();
if ( $mot_exist == 1 ){
?> <script type="text/javascript">alert("Bonne réponse.. Mais quelqu'un l'a déjà trouvé avant ;)");</script><?php
} else {
?> <script type="text/javascript">alert("Mauvaise réponse ! (Mouahahaha :D)");</script><?php
}
2022-06-12 21:45:19 +02:00
}
2023-06-22 17:30:50 +02:00
}
2022-06-12 23:52:11 +02:00
2020-09-19 16:08:07 +02:00
?>
2022-06-12 16:12:39 +02:00
< main >
2023-01-22 12:46:06 +01:00
2023-06-22 17:30:50 +02:00
<!--
-->
2020-09-19 16:08:07 +02:00
2023-01-22 12:46:06 +01:00
< br >
2023-06-22 17:30:50 +02:00
< ? php
// check si tout les mots ont été trouvés ou non. (toutes equipes confondues)
$req = $db -> prepare ( " SELECT * FROM mots_croise WHERE trouve=? " );
$req -> execute ( array ( htmlspecialchars ( FALSE )));
if ( $req -> rowCount () == 0 ){
?>
< div class = " zone_txt " >
< h1 > Pas assez rapide ! Tout les mots ont été trouvés !< h1 >
</ div >
< ? php
}
?>
<!--
_____
, - " " -.
/ o o \
/ \ / \
/ ) - " -( \
/ ( 6 6 ) \
/ \ " / \
/ ) = ( \
/ o .-- " - " --. o \
/ I / - - \ I \
.-- ( ( _ } y / \ / \y { _ ) ) --.
( " .___l \ /__ \ _____/__ \ /l___, " )
\ /
" -._ o O o O o O o _,- "
` -- Y --. ___________ .-- Y -- '
|==. ___________ .==| hjw
` ==. ___________ .== '
" MIAOU MIAOU " - Kaaris , 2021
2023-06-25 22:58:19 +02:00
Un grand merci à vectorizer . ai pour avoir trasnformé un vieux screenshot en svg
mais putain je vous en supplie les devs mettez un mode sans fond j ' ai perdu 10 points
de QI à enlever le blanc à l 'intérieur des lettres --'
2023-06-22 17:30:50 +02:00
-->
2023-04-22 18:47:14 +02:00
< div class = " zone_txt " >
2023-06-25 22:58:19 +02:00
< img src = " assets/img/mots_croises.svg " class = " mot_croise " >
2023-04-22 18:47:14 +02:00
</ div >
< div class = " zone_txt " >
2022-06-12 21:45:19 +02:00
< form method = " POST " >
2023-06-22 17:30:50 +02:00
< br >
< select name = " team " class = " input " required >
2022-06-12 21:45:19 +02:00
< option value = " " > Choisissez votre équipe </ option >
2023-01-26 15:53:45 +01:00
< option value = " <?= $TEAM1 ?> " >< ? = $TEAM1 ?> </option>
< option value = " <?= $TEAM2 ?> " >< ? = $TEAM2 ?> </option>
2023-06-22 17:30:50 +02:00
</ select >
2022-06-12 23:52:11 +02:00
2023-06-22 17:30:50 +02:00
< br >
< input type = " number " id = " id_mot " name = " id_mot " class = " numeric-input " required >
< label for = " id_mot " > Numéro du mot </ label >
< br >
< input type = " text " placeholder = " réponse " name = " mot " class = " input " required >
2022-06-12 23:52:11 +02:00
< br >< br >
2023-06-22 17:30:50 +02:00
< input type = " submit " name = " send " value = " Envoyer " class = " submit " >
2022-06-12 21:45:19 +02:00
</ form >
2023-06-22 17:43:50 +02:00
NB : Des indices se cachent peut - être ( ou peut être pas : D ) sur le site , CTR + U pourrais devenir ton meilleur ami .
2023-04-22 18:47:14 +02:00
</ div >
2023-06-22 17:30:50 +02:00
2022-06-12 16:12:39 +02:00
</ main >
2020-09-19 16:08:07 +02:00
< ? php
2023-01-22 12:46:06 +01:00
$infopage = [ " " , " Cahier de vacances " , ob_get_clean (), " " , " vacances " , " Mots croisés pour vous occuper pendant les vacances " ]; //relativepath, pagetitle, pagecontent, pagescript | cf structure/template.php ligne 2 à 6
2022-01-19 22:26:58 +01:00
include ( " structure/template.php " );
2023-08-03 12:39:42 +02:00
?>