";
+
$toDisp=5;
if(isset($_POST["game_mode"]) && $_POST["game_mode"]!="" && $_POST["difficulty"]!="" && $_POST["dotsAmount"]!="" && $_POST["pause"]!="")
{
- 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"].' order by score desc limit '.$toDisp;
- $unit="points";
- }
- 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"].' order by score asc limit '.$toDisp;
- $unit="secondes";
- }
- $result = $database->query($sql);
- $a=$result->fetchArray();
+ $db_game_mode=$_POST["game_mode"];
+ $db_difficulty=$_POST["difficulty"];
+ $db_dotsAmount=$_POST["dotsAmount"];
+ $db_pause=$_POST["pause"];
+}
+else
+{
+ $db_game_mode="5p";
+ $db_difficulty="easy";
+ $db_dotsAmount=$_COOKIE["dotsAmount"];
+ $db_pause=$_COOKIE["pause"];
+}
- if($a==false)
- {
- $phrase= "Il n'y a pas encore de score pour ce mode de jeu.";
- }
- else
- {
- $phrase="1° ".$a["player"].", ".$a[0]." ".$unit;
- $cpt=2;
- while ($row = $result->fetchArray()) {
+if(stristr($db_game_mode, "p") === FALSE)
+{
+ $sql='select score, player from score where game_mode="'.$db_game_mode.'" and difficulty="'.$db_difficulty.'" and dots_amount='.$db_dotsAmount.' and pause='.$db_pause.' order by score desc limit '.$toDisp;
+ $unit="points";
+}
+else
+{
+ $sql='select score, player from score where game_mode="'.$db_game_mode.'" and difficulty="'.$db_difficulty.'" and dots_amount='.$db_dotsAmount.' and pause='.$db_pause.' order by score asc limit '.$toDisp;
+ $unit="secondes";
+}
+$result = $database->query($sql);
+$a=$result->fetchArray();
- $phrase=$phrase."".$cpt."° ".$row["player"].", ".$row["score"]." ".$unit;
- $cpt++;
- }
+if($a==false)
+{
+ $phrase= "Il n'y a pas encore de score pour ce mode de jeu.";
+}
+else
+{
+ $phrase="1° ".$a["player"].", ".$a[0]." ".$unit;
+ $cpt=2;
+ while ($row = $result->fetchArray()) {
+
+ $phrase=$phrase."".$cpt."° ".$row["player"].", ".$row["score"]." ".$unit;
+ $cpt++;
+ }
}
- echo "