fixes
This commit is contained in:
parent
f3ad6a9ee1
commit
fec759b4b9
|
@ -66,7 +66,7 @@ switch ($_POST['act']){
|
||||||
OR (($map['0-2']==$map['1-1'])&&($map['1-1']==$map['2-0'])&&($map['2-0']!==""))
|
OR (($map['0-2']==$map['1-1'])&&($map['1-1']==$map['2-0'])&&($map['2-0']!==""))
|
||||||
){
|
){
|
||||||
echo "<p>".$playerName." ".$playerCHAR." a gagné.</p>";
|
echo "<p>".$playerName." ".$playerCHAR." a gagné.</p>";
|
||||||
save_battle('tictactoe',$bot1,$bot2,$playerPlayingNow);
|
save_battle('tictactoe',$bots[$bot1]['name'],$bots[$bot2]['name'],$playerPlayingNow);
|
||||||
$end=true;
|
$end=true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -80,7 +80,7 @@ switch ($_POST['act']){
|
||||||
}
|
}
|
||||||
if($full){
|
if($full){
|
||||||
echo "<p>Match nul</p>";
|
echo "<p>Match nul</p>";
|
||||||
save_battle('tictactoe',$bot1,$bot2,0);
|
save_battle('tictactoe',$bots[$bot1]['name'],$bots[$bot2]['name'],0);
|
||||||
$end=true;
|
$end=true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -101,18 +101,12 @@ function error($code,$message){
|
||||||
}
|
}
|
||||||
function conn_bdd(){
|
function conn_bdd(){
|
||||||
require (__DIR__."/config.php");
|
require (__DIR__."/config.php");
|
||||||
$mysqlParams=array(
|
|
||||||
'host' => 'localhost',
|
|
||||||
'user' => '',
|
|
||||||
'pass' => '',
|
|
||||||
'database'=>''
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!$linkMysql=mysqli_connect($mysqlParams['host'], $mysqlParams['user'], $mysqlParams['pass'])) {
|
if (!$linkMysql=mysqli_connect($mysqlParams['host'], $mysqlParams['user'], $mysqlParams['pass'])) {
|
||||||
error(500,'database connexion failed');
|
error(500,'database connexion failed');
|
||||||
die;
|
die;
|
||||||
}
|
}
|
||||||
mysqli_select_db($linkMysql,$mysqlParams['mysql_database']);
|
mysqli_select_db($linkMysql,$mysqlParams['database']);
|
||||||
mysqli_set_charset($linkMysql, 'utf8');
|
mysqli_set_charset($linkMysql, 'utf8');
|
||||||
return $linkMysql; //does PHP can do that?
|
return $linkMysql; //does PHP can do that?
|
||||||
|
|
||||||
|
@ -126,7 +120,6 @@ function save_battle($game,$bot1,$bot2,$resultat){
|
||||||
$rs=mysqli_query($lnMysql,"SELECT name,id FROM bots
|
$rs=mysqli_query($lnMysql,"SELECT name,id FROM bots
|
||||||
WHERE name='".mysqli_real_escape_string($lnMysql,$bot1)."'
|
WHERE name='".mysqli_real_escape_string($lnMysql,$bot1)."'
|
||||||
OR name='".mysqli_real_escape_string($lnMysql,$bot2)."'");
|
OR name='".mysqli_real_escape_string($lnMysql,$bot2)."'");
|
||||||
|
|
||||||
while($r=mysqli_fetch_row($rs)){
|
while($r=mysqli_fetch_row($rs)){
|
||||||
$bots[$r[0]]=$r[1];
|
$bots[$r[0]]=$r[1];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user