diff --git a/src/arenas/tictactoe/act.php b/src/arenas/tictactoe/act.php index 38e919e..8517b3b 100644 --- a/src/arenas/tictactoe/act.php +++ b/src/arenas/tictactoe/act.php @@ -4,7 +4,7 @@ require_once(__DIR__."/functions.php"); switch ($_POST['act']){ case "fight": - $bots=get_Bots_Array(); + $bots=get_Bots_Array('tictactoe'); //clean $_POST vars $postParams=get_Post_Params(count($bots)); if(!$postParams){ diff --git a/src/arenas/tictactoe/functions.php b/src/arenas/tictactoe/functions.php index 0d987e6..db1936f 100644 --- a/src/arenas/tictactoe/functions.php +++ b/src/arenas/tictactoe/functions.php @@ -16,6 +16,7 @@ function get_Post_Params($botsCount){ return array('bot1' => $_POST['bot1'],'bot2' => $_POST['bot2']); } +/* function get_Bots_Array(){ //Recupérer la liste des Bots $bots=array(); @@ -29,6 +30,7 @@ function get_Bots_Array(){ } return $bots; } +*/ function get_IA_Response($youChar,$iaBaseUrl,$grille){ /*transforme la grille en parametres http GET * et fait la requete vers $iaBaseUrl diff --git a/src/arenas/tictactoe/listOfBots.txt b/src/arenas/tictactoe/listOfBots.txt deleted file mode 100644 index fd17f62..0000000 --- a/src/arenas/tictactoe/listOfBots.txt +++ /dev/null @@ -1,3 +0,0 @@ -stupidAI http://morpionmaster.tinad.fr/stupidIa.php -moul http://tictactoe.m.42.am/ -Gnieark http://morpionmaster.tinad.fr/gnieark.php diff --git a/src/arenas/tictactoe/public.php b/src/arenas/tictactoe/public.php index 4e111fa..106542c 100644 --- a/src/arenas/tictactoe/public.php +++ b/src/arenas/tictactoe/public.php @@ -1,7 +1,7 @@ $name, "url" =>$url); + + if($activeOnly){ + $addClause=" AND active='1'"; + }else{ + $addClause=""; + } + + $rs=mysqli_query($lnMysql, + "SELECT id,name,url,description FROM bots WHERE game='".mysqli_real_escape_string($lnMysql,$arena)."'".$addClause); + $bots=array(); + while($r=mysqli_fetch_row($rs)){ + $bots[]=array( + 'id' => $r[0], + 'name'=> $r[1], + 'url' => $r[2], + 'description' => $r[3] + ) + } + return $bots; +} function rand_str($length = 32, $chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890'){ $chars_length = (strlen($chars) - 1); @@ -14,6 +37,7 @@ function rand_str($length = 32, $chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijkl } return $string; } + function xd_check_input($id=1){ /* *On génére un hash aléatoire qui sera