@ -3,111 +3,72 @@
< / head >
< form action = "highscores.php" method = "post" >
< p > difficulty : < input type = "text" name = "diff" / > < / p >
< p > dotsAmount : < input type = "text" name = "dotsAmount" / > < / p >
< p > pause : < input type = "text" name = "pause" / > < / p >
< div id = "modeSelection" >
< ul id = "modes" >
< img id = "img_points" class = "button" src = "./ress/button_mode_points.png" / >
< ul id = "modes" >
< img id = "img_points" class = "button" src = "./ress/button_mode_points.png" / >
< img id = "img_temps" class = "button" src = "./ress/button_mode_temps.png" / >
< img id = "img_temps" class = "button" src = "./ress/button_mode_temps.png" / >
< img id = "img_survie" class = "button" src = "./ress/button_mode_survie.png" / >
< / ul >
< img id = "img_survie" class = "button" src = "./ress/button_mode_survie.png" / >
< / ul >
< ul id = "points" class = "all-container" >
< input type = "radio " name = "game_mode" id = "5p" value = "5p" / >
< label for = "5p" > < img id = "img_5p" class = "button" src = "./ress/button_points_5.png" / > < / label >
< input type = "radio " class = "rad " name = "game_mode" id = "5p" value = "5p" / >
< label for = "5p" > < img id = "img_5p" class = "button" src = "./ress/button_points_5.png" / > < / label >
< input type = "radio " name = "game_mode" id = "10p" value = "10p" / >
< label for = "10p" > < img id = "img_10p" class = "button" src = "./ress/button_points_10.png" / > < / label >
< input type = "radio " class = "rad " name = "game_mode" id = "10p" value = "10p" / >
< label for = "10p" > < img id = "img_10p" class = "button" src = "./ress/button_points_10.png" / > < / label >
< input type = "radio " name = "game_mode" id = "15p" value = "15p" / >
< label for = "15p" > < img id = "img_15p" class = "button" src = "./ress/button_points_15.png" / > < / label >
< input type = "radio " class = "rad " name = "game_mode" id = "15p" value = "15p" / >
< label for = "15p" > < img id = "img_15p" class = "button" src = "./ress/button_points_15.png" / > < / label >
< input type = "radio " name = "game_mode" id = "20p" value = "20p" / >
< label for = "20p" > < img id = "img_20p" class = "button" src = "./ress/button_points_20.png" / > < / label >
< input type = "radio " class = "rad " name = "game_mode" id = "20p" value = "20p" / >
< label for = "20p" > < img id = "img_20p" class = "button" src = "./ress/button_points_20.png" / > < / label >
< / ul >
< ul id = "temps" class = "all-container" >
< input type = "radio " name = "game_mode" id = "5m" value = "5m" / >
< label for = "5m" > < img id = "img_5m" class = "button" src = "./ress/button_temps_5.png" / > < / label >
< input type = "radio " class = "rad " name = "game_mode" id = "5m" value = "5m" / >
< label for = "5m" > < img id = "img_5m" class = "button" src = "./ress/button_temps_5.png" / > < / label >
< input type = "radio " name = "game_mode" id = "10m" value = "10m" / >
< label for = "10m" > < img id = "img_10m" class = "button" src = "./ress/button_temps_10.png" / > < / label >
< input type = "radio " class = "rad " name = "game_mode" id = "10m" value = "10m" / >
< label for = "10m" > < img id = "img_10m" class = "button" src = "./ress/button_temps_10.png" / > < / label >
< / ul >
< ul id = "survie" class = "all-container" >
< input type = "radio " name = "game_mode" id = "15s" value = "15s" / >
< label for = "15s" > < img id = "img_15s" class = "button" src = "./ress/button_survie_15.png" / > < / label >
< input type = "radio " class = "rad " name = "game_mode" id = "15s" value = "15s" / >
< label for = "15s" > < img id = "img_15s" class = "button" src = "./ress/button_survie_15.png" / > < / label >
< input type = "radio" name= "game_mode" id = "30s" value = "30s" / >
< label for = "30s" > < img id = "img_30s" class = "button" src = "./ress/button_survie_30.png" / > < / label >
< input type = "radio" class= "rad" name= "game_mode" id = "30s" value = "30s" / >
< label for = "30s" > < img id = "img_30s" class = "button" src = "./ress/button_survie_30.png" / > < / label >
< input type = "radio" name= "game_mode" id = "45s" value = "45s" / >
< label for = "45s" > < img id = "img_45s" class = "button" src = "./ress/button_survie_45.png" / > < / label >
< input type = "radio" class= "rad" name= "game_mode" id = "45s" value = "45s" / >
< label for = "45s" > < img id = "img_45s" class = "button" src = "./ress/button_survie_45.png" / > < / label >
< / ul >
< / div >
< input type = "image" src = "ress/red.png" alt = "Submit" width = "48" height = "48" >
< / form >
<!--
< form action = "#" >
< input type = "radio" name = "radio-choice2" id = "radio-choice-2" / >
< label for = "radio-choice-2" > < img id = "img_temps" class = "button" src = "./ress/button_mode_temps.png" / > < / label >
< input type = "radio" name = "radio-choice2" id = "radio-choice-2" / >
< label for = "radio-choice-2" > < img id = "img_temps" class = "button" src = "./ress/button_mode_temps.png" / > < / label >
< input type = "radio" name = "radio-choice2" id = "radio-choice-2" / >
< label for = "radio-choice-2" > < img id = "img_temps" class = "button" src = "./ress/button_mode_temps.png" / > < / label >
< input type = "radio" name = "radio-choice2" id = "radio-choice-2" / >
< label for = "radio-choice-2" > < img id = "img_temps" class = "button" src = "./ress/button_mode_temps.png" / > < / label >
< input type = "radio" name = "radio-choice3" id = "radio-choice-2" / >
< label for = "radio-choice-2" > < img id = "img_temps" class = "button" src = "./ress/button_mode_temps.png" / > < / label >
< input type = "radio" name = "radio-choice3" id = "radio-choice-2" / >
< label for = "radio-choice-2" > < img id = "img_temps" class = "button" src = "./ress/button_mode_temps.png" / > < / label >
< input type = "radio" name = "radio-choice3" id = "radio-choice-2" / >
< label for = "radio-choice-2" > < img id = "img_temps" class = "button" src = "./ress/button_mode_temps.png" / > < / label >
< div >
< input type = "submit" value = "Valider" / >
< / div >
< / form >
< div id = "modeSelection" >
< ul id = "modes" class = "all-container" >
< img id = "img_survie" class = "button" src = "./ress/button_mode_survie.png" / >
< / ul >
< ul id = "points" class = "all-container" >
< img id = "img_5p" class = "button" src = "./ress/button_points_5.png" / >
< img id = "img_10p" class = "button" src = "./ress/button_points_10.png" / >
< img id = "img_15p" class = "button" src = "./ress/button_points_15.png" / >
< img id = "img_20p" class = "button" src = "./ress/button_points_20.png" / >
< / ul >
< ul id = "temps" class = "all-container" >
< img id = "img_5m" class = "button" src = "./ress/button_temps_5.png" / >
< img id = "img_10m" class = "button" src = "./ress/button_temps_10.png" / >
< / ul >
< ul id = "survie" class = "all-container" >
< img id = "img_15s" class = "button" src = "./ress/button_survie_15.png" / >
< img id = "img_30s" class = "button" src = "./ress/button_survie_30.png" / >
< img id = "img_45s" class = "button" src = "./ress/button_survie_45.png" / >
< / ul >
< / div >
< ul id = "diff" class = "all-container" >
< img id = "img_easy" class = "button" src = "./ress/button_diff_easy.png" / >
< img id = "img_med" class = "button" src = "./ress/button_diff_normal.png" / >
< img id = "img_hard" class = "button" src = "./ress/button_diff_hard.png" / >
< input type = "radio" class = "rad" name = "difficulty" id = "easy" value = "easy" / >
< label for = "easy" > < img id = "img_easy" class = "button" src = "./ress/button_diff_easy.png" / > < / label >
< input type = "radio" class = "rad" name = "difficulty" id = "med" value = "med" / >
< label for = "med" > < img id = "img_med" class = "button" src = "./ress/button_diff_normal.png" / > < / label >
< input type = "radio" class = "rad" name = "difficulty" id = "hard" value = "hard" / >
< label for = "hard" > < img id = "img_hard" class = "button" src = "./ress/button_diff_hard.png" / > < / label >
< / ul >
-->
< div >
< p > Mode pause activé : < / p >
< input type = "radio" id = "yes_pause" value = "1" name = "pause" >
< label for = "no_pause" > Oui< / label >
< input type = "radio" id = "no_pause" value = "0" name = "pause" >
< label for = "no_pause" > Non< / label >
< / div >
< p > Changer le nombre de points< / p >
< input type = "range" min = "2" max = "8" class = "slider" name = "dotsAmount" id = "range_dots" >
< p > Nombre de points : < span id = "dotsNumber" > < / span > < / p >
< input type = "image" src = "ress/red.png" alt = "Submit" width = "48" height = "48" >
< / form >
< script src = "highscore_button_displayer.js" > < / script >
<?php
@ -115,20 +76,31 @@ $database = new SQLite3("data.db");
if($_POST["game_mode"]!="" & & $_POST["diff"]!="" & & $_POST["dotsAmount"]!="" & & $_POST["pause"]!="")
if($_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['diff'].'" 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['diff'].'" and dots_amount='.$_POST["dotsAmount"].' and pause='.$_POST["pause"].')';
$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"].')';
}
else
{
$sql='select score, player from score where game_mode="'.$_POST['game_mode'].'" and difficulty="'.$_POST['diff'].'" 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['diff'].'" and dots_amount='.$_POST["dotsAmount"].' and pause='.$_POST["pause"].')';
$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"].')';
}
$result = $database->query($sql);
$a=$result->fetchArray();
echo "< h1 id = 'aya' > ".print_r($a)."< / h1 > ";
echo "< h1 id = 'aye' > ".var_dump($_POST)."< / h1 > ";
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' > ".$phrase."< / h1 > ";
}