From 13b80dd98388afeb98efbd9c0538486fceb0c01d Mon Sep 17 00:00:00 2001 From: gnieark Date: Sun, 29 Nov 2015 08:26:19 +0100 Subject: [PATCH 1/9] structure BDD --- install.sql | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/install.sql b/install.sql index 22baddd..816fc00 100644 --- a/install.sql +++ b/install.sql @@ -3,7 +3,8 @@ CREATE TABLE IF NOT EXISTS `arena_history` ( `player1_id` int(11) NOT NULL, `player2_id` int(11) NOT NULL, `player1_winsCount` int(11) NOT NULL, - `player2_winsCount` int(11) NOT NULL + `player2_winsCount` int(11) NOT NULL, + `nulCount` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; ALTER TABLE `arena_history` ADD PRIMARY KEY (`game`,`player1_id`,`player2_id`); From 45d497629aa3273eb5dfd8f2eeafa78e677a2aeb Mon Sep 17 00:00:00 2001 From: gnieark Date: Sun, 29 Nov 2015 09:42:34 +0100 Subject: [PATCH 2/9] affichage scores --- html/index.php | 13 +++++++++++++ lang/en.php | 4 +++- lang/fr.php | 5 ++++- src/functions.php | 33 +++++++++++++++++++++++++++++++++ 4 files changed, 53 insertions(+), 2 deletions(-) diff --git a/html/index.php b/html/index.php index cc3cb91..d7256c4 100644 --- a/html/index.php +++ b/html/index.php @@ -108,6 +108,19 @@ if($currentArena == ""){ break; default: include ("../src/arenas/".$currentArena."/public.php"); + + //battle history for this arena + $hist=get_battles_history($currentArena); + echo '' break; } ?> diff --git a/lang/en.php b/lang/en.php index a5a1cf5..482f0a7 100644 --- a/lang/en.php +++ b/lang/en.php @@ -2,5 +2,7 @@ $lang=array( 'SITE_NAME' => 'bots\'arena', 'SITE_DESCRIPTION' => 'blah blah blah but english', - 'HOME' => 'Home page' + 'HOME' => 'Home page', + 'VICTORIES' => 'victories', + 'DRAW' => 'drawn match' ); \ No newline at end of file diff --git a/lang/fr.php b/lang/fr.php index 28d83f3..87b30a5 100644 --- a/lang/fr.php +++ b/lang/fr.php @@ -5,5 +5,8 @@ $lang=array( '

Bienvenue sur cette arène à bots.
Plusieurs jeux sont proposés ici. Vous ne devez pas y jouer, mais dévolopper le "bot" qui jouera en votre nom. Ce site permet de faire s\'affronter les bots des différents développeurs.

', - 'HOME' => 'accueil' + 'HOME' => 'accueil', + 'VICTORIES' => 'victoires', + 'DRAW' => 'matchs nuls' + ); \ No newline at end of file diff --git a/src/functions.php b/src/functions.php index fe4b7f0..88af273 100644 --- a/src/functions.php +++ b/src/functions.php @@ -111,6 +111,39 @@ function conn_bdd(){ return $linkMysql; //does PHP can do that? } +function get_battles_history($game){ + $lnMysql=conn_bdd(); + $rs=mysqli_query($lnMysql, + " SELECT + player1.name, + player2.name, + arena_history.player1_winsCount, + arena_history.player2_winsCount, + arena_history.nulCount + FROM + bots as player1, + bots as player2, + arena_history + WHERE + player1.id=arena_history.player1_id + AND player2.id=arena_history.player2_id + AND arena_history.game='".mysqli_real_escape_string($lnMysql,$game)."';" + ); + + $results=array(); + while($r=mysqli_fetch_row($rs)){ + $results[]= array( + 'bot1' => $r[0], + 'bot2' => $r[1], + 'player1Wins' => $r[2], + 'player2Wins' => $r[3], + 'draws' => $r[4] + ); + + } + mysqli_close($lnMysql); + return $results; +} function save_battle($game,$bot1,$bot2,$resultat){ //resultat: 0 match nul, 1 bot1 gagne 2 bot 2 gagne From 4cb6a439f3f730bc02ab146aecbfd7e866eb9cbd Mon Sep 17 00:00:00 2001 From: gnieark Date: Sun, 29 Nov 2015 09:44:54 +0100 Subject: [PATCH 3/9] fix dot missing --- html/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/html/index.php b/html/index.php index d7256c4..b6d8543 100644 --- a/html/index.php +++ b/html/index.php @@ -117,7 +117,7 @@ if($currentArena == ""){
  • '.$sc['bot1']." ".$lang['VICTORIES'].":".$sc['player1Wins'].'
  • '.$sc['bot2']." ".$lang['VICTORIES'].":".$sc['player2Wins'].'
  • -
  • '$lang['DRAW'].":".$sc['draws'].'
  • +
  • '.$lang['DRAW'].":".$sc['draws'].'
'; } echo '' From 7d9881d78787c4580425f99ef0ddae0f3529bca3 Mon Sep 17 00:00:00 2001 From: gnieark Date: Sun, 29 Nov 2015 09:45:32 +0100 Subject: [PATCH 4/9] fix ; missing --- html/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/html/index.php b/html/index.php index b6d8543..3c89aa3 100644 --- a/html/index.php +++ b/html/index.php @@ -120,7 +120,7 @@ if($currentArena == ""){
  • '.$lang['DRAW'].":".$sc['draws'].'
  • '; } - echo '' + echo ''; break; } ?> From cbab579ea64e86ed93e8efb9a5119952c41adc72 Mon Sep 17 00:00:00 2001 From: Gnieark Date: Sun, 29 Nov 2015 10:42:54 +0100 Subject: [PATCH 5/9] css a ameliorer, apres que je me sois fait une citronade --- html/style.css | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/html/style.css b/html/style.css index 137e61e..a97a8b6 100644 --- a/html/style.css +++ b/html/style.css @@ -54,3 +54,12 @@ section{ overflow: hidden; width: 90%; } +article{ + float: left; + width:70%; +} +aside{ + float:right; + width: 28%; +} + From 1dd06b939cc08c644a546cec31fa21097cb54262 Mon Sep 17 00:00:00 2001 From: gnieark Date: Sun, 29 Nov 2015 11:12:47 +0100 Subject: [PATCH 6/9] achehteumeuleu --- html/index.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/html/index.php b/html/index.php index 3c89aa3..3ce4ee5 100644 --- a/html/index.php +++ b/html/index.php @@ -111,9 +111,9 @@ if($currentArena == ""){ //battle history for this arena $hist=get_battles_history($currentArena); - echo '