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