forked from vergnet/site-accueil-insa
enigme plaquette finito
This commit is contained in:
parent
d0ce7c85a7
commit
1653b0d4d0
4 changed files with 107 additions and 4 deletions
|
@ -0,0 +1,15 @@
|
|||
* {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
section {
|
||||
display: block;
|
||||
background-color: rgba(255,255,255,0.3);
|
||||
width: 80%;
|
||||
max-width: 800px;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
padding: 50px;
|
||||
font-size: 1.2rem;
|
||||
margin-top: 40px;
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
section {
|
||||
display: block;
|
||||
background-color: rgba(255,255,255,0.3);
|
||||
width: 80%;
|
||||
max-width: 800px;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
padding: 50px;
|
||||
font-size: 1.2rem;
|
||||
margin-top: 40px;
|
||||
}
|
77
enigma.php
77
enigma.php
|
@ -1,6 +1,83 @@
|
|||
<?php
|
||||
ob_start(); // Start reading html
|
||||
|
||||
include "script/db.php";
|
||||
|
||||
if(isset($_POST['send'])) {
|
||||
if(!empty($_POST['answer']) AND !empty($_POST['team'])) {
|
||||
|
||||
$ans = htmlspecialchars($_POST['answer']);
|
||||
$team = htmlspecialchars($_POST['team']);
|
||||
|
||||
$req = $db->query('SELECT answer, point, team FROM enigma WHERE id = 1'); //id = 1 est la ligne correspondant à l'énigme de la plaquette
|
||||
$reponse = $req -> fetchAll(PDO::FETCH_ASSOC);
|
||||
|
||||
if($reponse[0]['team'] == NULL) {
|
||||
//le "if" ici c'est parce que le 0 => $team = NULL du coup on doit genre faire une conversion relou
|
||||
if($team == "pkpeach") {
|
||||
$team = 0;
|
||||
} elseif($team == "boomario") {
|
||||
$team = 1;
|
||||
} else {
|
||||
header('Refresh: 0');
|
||||
}
|
||||
|
||||
|
||||
if($ans == $reponse[0]['answer']) {
|
||||
$req = $db->prepare("INSERT INTO scores(texte, points, team) VALUES(?, ?, ?)");
|
||||
$req->execute(array("enigme de la plaquette", $reponse[0]['point'], $team));
|
||||
|
||||
$req = $db->prepare("UPDATE enigma SET team = ? WHERE id = 1");
|
||||
$req->execute(array($team));
|
||||
?><script type="text/javascript">alert("Félicitation, vous avez fait gagner <?= $reponse[0]['point'] ?>points à votre équipe");</script><?php
|
||||
} else {
|
||||
$error = "Mauvaise réponse, try again !";
|
||||
}
|
||||
} else {
|
||||
$error = "petit malin, la réponse à déjà été trouvé";
|
||||
}
|
||||
} else {
|
||||
$error = "Il faut remplir tout les champs ;)";
|
||||
}
|
||||
}
|
||||
?>
|
||||
<div class="box-jaune">
|
||||
<span class="corners corners-top"></span>
|
||||
<span class="corners corners-bottom"></span>
|
||||
|
||||
<div class="title">Enigme de la plaquette</div>
|
||||
|
||||
<span class="circles circles-top"></span>
|
||||
<span class="circles circles-bottom"></span>
|
||||
</div>
|
||||
|
||||
<section>
|
||||
<?php
|
||||
$req = $db->query('SELECT team FROM enigma WHERE id = 1'); //id = 1 est la ligne correspondant à l'énigme de la plaquette
|
||||
$reponse = $req -> fetchAll(PDO::FETCH_ASSOC);
|
||||
|
||||
//var_dump($reponse);
|
||||
if($reponse[0]['team'] == NULL) {
|
||||
?>
|
||||
<form method="POST">
|
||||
<input type="text" placeholder="Réponse à l'énigme" name="answer">
|
||||
<select name="team">
|
||||
<option value="">Choisissez votre équipe</option>
|
||||
<option value="pkpeach">PKpeach</option>
|
||||
<option value="boomario">Boomario</option>
|
||||
</select>
|
||||
<input type="submit" name="send" value="Valider votre réponse">
|
||||
</form>
|
||||
<?php
|
||||
} else {
|
||||
echo "La réponse de l'énigme de la plaquette à déja été trouvé !";
|
||||
}
|
||||
|
||||
if(isset($error)) {
|
||||
echo $error;
|
||||
}
|
||||
?>
|
||||
</section>
|
||||
|
||||
<?php
|
||||
$infopage = ["", "Enigma", ob_get_clean(), "", "enigma"]; //relativepath, pagetitle, pagecontent, pagescript, pagename | cf structure/template.php ligne 2 à 6
|
||||
|
|
|
@ -144,8 +144,8 @@ if(!isset($relativepath)) {
|
|||
</a>';
|
||||
}
|
||||
$co_y_1 = [-23.5, 25.35,74.2, 123.05, 171.9, 220.75, 269.6, 318.45, 367.3, 416.15, 465];
|
||||
$texte_y_1 = ["", "Photos","Lydia/Izly", "Les clubs", "Prévention", "Com'ville", "", "", "Download", "Les com's", "Infos"];
|
||||
$lien_y_1 = ["", "photos.php","lydia.php", "clubs.php", "prevs.php", "map_com_ville.php", "", "", "downloads.php", "coms.php", "info.php"];
|
||||
$texte_y_1 = ["", "Photos","Lydia/Izly", "Les clubs", "Prévention", "Com'ville", "Enigme", "", "Download", "Les com's", "Infos"];
|
||||
$lien_y_1 = ["", "photos.php","lydia.php", "clubs.php", "prevs.php", "map_com_ville.php", "enigma.php", "", "downloads.php", "coms.php", "info.php"];
|
||||
for($i = 0; $i <= 10; $i++) {
|
||||
echo
|
||||
'<a href="'.$lien_y_1[$i].'" class="menu-link menu-bottom-line">
|
||||
|
@ -189,8 +189,8 @@ if(!isset($relativepath)) {
|
|||
}
|
||||
|
||||
$co_y_1 = [-23.5, 25.35,74.2, 123.05, 171.9, 220.75, 269.6, 318.45, 367.3, 416.15, 465];
|
||||
$texte_y_1 = ["Lydia/Izly", "Les clubs", "Prévention", "Com'ville", "", "", "", "", "Download", "Les com's", "Infos"];
|
||||
$lien_y_1 = ["lydia.php", "clubs.php", "prevs.php", "map_com_ville.php", "", "", "", "", "downloads.php", "coms.php", "info.php"];
|
||||
$texte_y_1 = ["Lydia/Izly", "Les clubs", "Prévention", "Com'ville", "Enigme", "", "", "", "Download", "Les com's", "Infos"];
|
||||
$lien_y_1 = ["lydia.php", "clubs.php", "prevs.php", "map_com_ville.php", "enigma.php", "", "", "", "downloads.php", "coms.php", "info.php"];
|
||||
for($i = 0; $i <= 10; $i++) {
|
||||
echo
|
||||
'<a href="'.$lien_y_1[$i].'" class="mobile-menu-link">
|
||||
|
|
Loading…
Reference in a new issue