mysql powa

This commit is contained in:
Gnieark 2015-11-30 22:28:20 +01:00
parent f3b3a24d3f
commit 2935c21349
5 changed files with 28 additions and 5 deletions

View File

@ -4,7 +4,7 @@ require_once(__DIR__."/functions.php");
switch ($_POST['act']){ switch ($_POST['act']){
case "fight": case "fight":
$bots=get_Bots_Array(); $bots=get_Bots_Array('tictactoe');
//clean $_POST vars //clean $_POST vars
$postParams=get_Post_Params(count($bots)); $postParams=get_Post_Params(count($bots));
if(!$postParams){ if(!$postParams){

View File

@ -16,6 +16,7 @@ function get_Post_Params($botsCount){
return array('bot1' => $_POST['bot1'],'bot2' => $_POST['bot2']); return array('bot1' => $_POST['bot1'],'bot2' => $_POST['bot2']);
} }
/*
function get_Bots_Array(){ function get_Bots_Array(){
//Recupérer la liste des Bots //Recupérer la liste des Bots
$bots=array(); $bots=array();
@ -29,6 +30,7 @@ function get_Bots_Array(){
} }
return $bots; return $bots;
} }
*/
function get_IA_Response($youChar,$iaBaseUrl,$grille){ function get_IA_Response($youChar,$iaBaseUrl,$grille){
/*transforme la grille en parametres http GET /*transforme la grille en parametres http GET
* et fait la requete vers $iaBaseUrl * et fait la requete vers $iaBaseUrl

View File

@ -1,3 +0,0 @@
stupidAI http://morpionmaster.tinad.fr/stupidIa.php
moul http://tictactoe.m.42.am/
Gnieark http://morpionmaster.tinad.fr/gnieark.php

View File

@ -1,7 +1,7 @@
<?php <?php
require_once(__DIR__."/functions.php"); require_once(__DIR__."/functions.php");
$bots=get_Bots_Array(); $bots=get_Bots_Array('tictactoe');
$postParams=get_Post_Params(count($bots)); $postParams=get_Post_Params(count($bots));
if(!$postParams){ if(!$postParams){
$bot1=""; $bot1="";

View File

@ -3,6 +3,29 @@ function get_arenas_list(){
include (__DIR__."/arenas_lists.php"); include (__DIR__."/arenas_lists.php");
return $arenas; return $arenas;
} }
function(get_Bots_Array($arena,$activeOnly=true){
global $lnMysql;
//$bots[]=array("name" => $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'){ function rand_str($length = 32, $chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890'){
$chars_length = (strlen($chars) - 1); $chars_length = (strlen($chars) - 1);
@ -14,6 +37,7 @@ function rand_str($length = 32, $chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijkl
} }
return $string; return $string;
} }
function xd_check_input($id=1){ function xd_check_input($id=1){
/* /*
*On génére un hash aléatoire qui sera *On génére un hash aléatoire qui sera