score s'affiche entre "consulter" et "jouer"

master
adplantade 5 years ago
parent f65b8f5f29
commit af2f467616

@ -88,54 +88,51 @@
<img id="btn_high_des" src="ress/button_consult_desac.png"/>
</div>
</form>
<div id="play" class="mode-container">
<!--<div class="texte">
Pseudo :
<input type="text" id="field_pseudo" /><br/>-->
<img id="btn_play" src="ress/button_play.png" onClick="play()"/>
<img id="btn_play_des" src="ress/button_play_desac.png"/>
</div>
</div>
<?php
$database = new SQLite3("data.db");
$database = new SQLite3("data.db");
if(isset($_POST["game_mode"]) && $_POST["game_mode"]!="" && $_POST["difficulty"]!="" && $_POST["dotsAmount"]!="" && $_POST["pause"]!="")
if(isset($_POST["game_mode"]) && $_POST["game_mode"]!="" && $_POST["difficulty"]!="" && $_POST["dotsAmount"]!="" && $_POST["pause"]!="")
{
if(stristr($_POST['game_mode'], "p") === FALSE)
{
if(stristr($_POST['game_mode'], "p") === FALSE)
{
$sql='select score, player from score where game_mode="'.$_POST['game_mode'].'" and difficulty="'.$_POST['difficulty'].'" and dots_amount='.$_POST["dotsAmount"].' and pause='.$_POST["pause"].' and score=(select max(score) from score where game_mode="'.$_POST['game_mode'].'" and difficulty="'.$_POST['difficulty'].'" and dots_amount='.$_POST["dotsAmount"].' and pause='.$_POST["pause"].')';
}
else
{
$sql='select score, player from score where game_mode="'.$_POST['game_mode'].'" and difficulty="'.$_POST['difficulty'].'" and dots_amount='.$_POST["dotsAmount"].' and pause='.$_POST["pause"].' and score=(select min(score) from score where game_mode="'.$_POST['game_mode'].'" and difficulty="'.$_POST['difficulty'].'" and dots_amount='.$_POST["dotsAmount"].' and pause='.$_POST["pause"].')';
}
$result = $database->query($sql);
$a=$result->fetchArray();
if($a==false)
{
$phrase= "Il n'y a pas encore de score pour ce mode de jeu.";
}
else
{
$phrase="Le record est ".$a[0].", tenu par ".$a["player"];
while ($row = $result->fetchArray()) {
$phrase=$phrase.", ".$row["player"];
}
$sql='select score, player from score where game_mode="'.$_POST['game_mode'].'" and difficulty="'.$_POST['difficulty'].'" and dots_amount='.$_POST["dotsAmount"].' and pause='.$_POST["pause"].' and score=(select max(score) from score where game_mode="'.$_POST['game_mode'].'" and difficulty="'.$_POST['difficulty'].'" and dots_amount='.$_POST["dotsAmount"].' and pause='.$_POST["pause"].')';
}
else
{
$sql='select score, player from score where game_mode="'.$_POST['game_mode'].'" and difficulty="'.$_POST['difficulty'].'" and dots_amount='.$_POST["dotsAmount"].' and pause='.$_POST["pause"].' and score=(select min(score) from score where game_mode="'.$_POST['game_mode'].'" and difficulty="'.$_POST['difficulty'].'" and dots_amount='.$_POST["dotsAmount"].' and pause='.$_POST["pause"].')';
}
$result = $database->query($sql);
$a=$result->fetchArray();
echo "<h1 id='aya' class='texte' >".$phrase."</h1>";
echo "<input type='hidden' id='modeSel' value='".$_POST["game_mode"]."'/>";
echo "<input type='hidden' id='diffSel' value='".$_POST["difficulty"]."'/>";
echo "<input type='hidden' id='dotsAmountSel' value='".$_POST["dotsAmount"]."'/>";
echo "<input type='hidden' id='pauseSel' value='".$_POST["pause"]."'/>";
if($a==false)
{
$phrase= "Il n'y a pas encore de score pour ce mode de jeu.";
}
?>
else
{
$phrase="Le record est ".$a[0].", tenu par ".$a["player"];
while ($row = $result->fetchArray()) {
$phrase=$phrase.", ".$row["player"];
}
}
echo "<h1 id='aya' class='texte' >".$phrase."</h1>";
echo "<input type='hidden' id='modeSel' value='".$_POST["game_mode"]."'/>";
echo "<input type='hidden' id='diffSel' value='".$_POST["difficulty"]."'/>";
echo "<input type='hidden' id='dotsAmountSel' value='".$_POST["dotsAmount"]."'/>";
echo "<input type='hidden' id='pauseSel' value='".$_POST["pause"]."'/>";
}
?>
<div id="play" class="mode-container">
<img id="btn_play" src="ress/button_play.png" onClick="play()"/>
<img id="btn_play_des" src="ress/button_play_desac.png"/>
</div>
</div>
<img id="btn_back" src="ress/button_back.png" class="back" onClick="index()"/>

Loading…
Cancel
Save