correction requête index qui ne se fait pas

+ correction logo pour adapter aux droits
master
adplantade 5 years ago
parent 723d6e8382
commit ed4c530f8d

@ -142,29 +142,44 @@
$database = new SQLite3("data.db");
// echo isset($_POST["game_mode"])." ".isset($_POST["difficulty"])." ".isset($_POST["dotsAmount"])." ".isset($_POST["pause"]);
//$ph = $_POST["game_mode"]."|".$_POST["difficulty"]."|".$_POST["dotsAmount"]."|".$_POST["pause"];
//echo "<h1 id='aya2' class='texte mode-container' >".$ph."</h1>";
$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;
$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(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="'.$_POST['game_mode'].'" and difficulty="'.$_POST['difficulty'].'" and dots_amount='.$_POST["dotsAmount"].' and pause='.$_POST["pause"].' order by score asc limit '.$toDisp;
}
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();
}
$result = $database->query($sql);
$a=$result->fetchArray();
if($a==false)
{
if($a==false)
{
$phrase= "Il n'y a pas encore de score pour ce mode de jeu.";
}
else
{
}
else
{
$phrase="1° ".$a["player"].", ".$a[0]." ".$unit;
$cpt=2;
while ($row = $result->fetchArray()) {
@ -175,12 +190,17 @@ if(isset($_POST["game_mode"]) && $_POST["game_mode"]!="" && $_POST["difficulty"]
}
echo "<h1 id='aya' class='texte mode-container' >".$phrase."</h1>";
echo "<h1 id='aya' class='texte mode-container' >".$phrase."</h1>";
if(isset($_POST["game_mode"]) && $_POST["game_mode"]!="" && $_POST["difficulty"]!="" && $_POST["dotsAmount"]!="" && $_POST["pause"]!="")
{
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 class="mode-container">
<ul id="btns_play">

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

@ -353,17 +353,17 @@ function copyMDArray(array) //permet la copie d'arrays sans copier les référen
function generate(){
tabObj=[copyMDArray(tab1),copyMDArray(tab2),copyMDArray(tab3),copyMDArray(tab4)];
tabObjCmp=[];
var actions=getRandomInt(4)+1;
var actions=getRandomInt(4)+1; //2-6
var swapTreshold=11;
var switchTreshold=11;
if(difficulty=="med") //70% tournerD, 30% swap
{
actions+=getRandomInt(3)+3;
actions+=getRandomInt(3)+3; //+4-6 6-12
swapTreshold=8;
}
if(difficulty=="hard") //50% tournerD, 30% swap, 20% switch
{
actions+=getRandomInt(5)+5;
actions+=getRandomInt(5)+5; //+6-10 12-22
swapTreshold=6;
switchTreshold=9;
}

Loading…
Cancel
Save