an arena //$_GET['doc'] -> arena documentation //$_GET['scores'] -> show fights'history for the arena //$_GET['page'] -> a simple page like about page, legals etc... //Nothing -> home page if(isset($_GET['arena'])){ $arenaId = $_GET['arena']; }elseif(isset($_GET['doc'])){ $arenaId = $_GET['doc']; }elseif(isset($_GET['scores'])){ $arenaId = $_GET['scores']; }else{ $arenaId = ""; } //hydrate require_once ("../src/arenas_lists.php"); $exists = false; foreach($arenas as $arena){ if($arenaId == "") break; if($arena['id'] == $arenaId){ $currentArena = new ARENA($arenaId); $currentArena->hydrate($arena); //add Bots on arena $rs=mysqli_query($lnMysql, "SELECT id,name,url,description,ELO FROM bots WHERE game='".mysqli_real_escape_string($lnMysql,$currentArena->get_id())."' AND active='1';" ); while($r=mysqli_fetch_array($rs)){ $bot = new BOT("plop"); $bot->hydrate($r); $currentArena->addBot($bot); } $exists = true; break; } } if((!$exists)&& ($arenaId <> ""))error(404,"Page not found ".$arenaId); //l'arene passée en url n'existe pass if($arenaId == ""){ echo "accueil"; }else{ foreach($currentArena->bots as $bot){ echo $bot->name."\n"; } } die(); //**********************rewriting this file! *************** //**********OLD code from here ************************************ $permitIndex=true; //will be set to false for pages that google or other bot must not index if(isset($_GET['arena'])){ //Arena //check if arena exists $currentArena = false; foreach($arenas as $arena){ if($arena['id'] == $_GET['arena']){ $currentArena = $_GET['arena']; $currentArenaArr=$arena; break; } } if(!$currentArena){ error(404,"Wrong parameter"); die; } $siteTitle=$currentArenaArr['title']; $siteDescription=$currentArenaArr['metaDescription']; $mainSectionScript="../src/arenas/".$currentArena."/public.php"; $asideSectionContent= get_default_aside_content($currentArena); $cssAdditionalScript=""; if(isset($currentArenaArr['cssFile'])){ $cssAdditionalScript.='"; } //arena specific script js (if needed) $jsAdditionalScript=""; if(isset($currentArenaArr['jsFile'])){ $jsAdditionalScript.='"; } }elseif(isset($_GET['doc'])){ //arena's documentation page //check if arena exists $currentArena = false; foreach($arenas as $arena){ if($arena['id'] == $_GET['doc']){ $currentArena = $_GET['doc']; $currentArenaArr=$arena; break; } } if(!$currentArena){ error(404,"Wrong parameter"); die; } $siteTitle = "Specifications ".$currentArenaArr['title']; $siteDescription = "documentation, faites votre propre bot pour ".$currentArenaArr['metaDescription']; $mainSectionScript = "../src/arenas/".$currentArenaArr['id']."/doc-".$lang['lang'].".html"; $asideSectionContent = ""; $cssAdditionalScript = ""; if(isset($currentArenaArr['cssFile'])){ $cssAdditionalScript.='"; } $jsAdditionalScript=""; }elseif(isset($_GET['scores'])){ //check if arena exists $currentArena = false; foreach($arenas as $arena){ if($arena['id'] == $_GET['scores']){ $currentArena = $_GET['scores']; $currentArenaArr=$arena; break; } } if(!$currentArena){ error(404,"Wrong parameter"); die; } $siteTitle="détail des combats ".$currentArenaArr['title']; $siteDescription="scores ".$currentArenaArr['metaDescription']; $mainSectionScript="../src/scores.php"; $asideSectionContent=get_default_aside_content($currentArena); $cssAdditionalScript=""; $jsAdditionalScript=""; }elseif(isset($_GET['page'])){ //simple page switch($_GET['page']){ case "legals": $siteTitle="Mentions légales - bots Arena"; $siteDescription="OSEF"; $mainSectionScript="../src/legals.html"; $asideSectionContent=''; //to do or not to do $cssAdditionalScript=""; $jsAdditionalScript=""; break; case "About": $siteTitle="About"; $siteDescription="bots arena about page"; $mainSectionScript="../src/about.html"; $asideSectionContent=''; //to do or not to do $cssAdditionalScript=""; $jsAdditionalScript=""; break; case "addBot": $siteTitle="Valider l'ajout d'une IA"; $siteDescription="bots arena about page"; $permitIndex=false; $mainSectionScript="../src/addBot.php"; $asideSectionContent=''; //to do $cssAdditionalScript=""; $jsAdditionalScript=""; break; case "aboutBot": if(!isset($_GET['params'])){ error(404,"Page does not exists"); die; } $rs=mysqli_query($lnMysql, "SELECT id,game,url,description,date_inscription FROM bots WHERE name='".mysqli_real_escape_string($lnMysql,$_GET['params'])."' AND active='1'"); if(!$r=mysqli_fetch_row($rs)){ error(404,"Page doesn't exist"); die; } $theBot=array( 'id' => $r[0], 'game' => $r[1], 'url' => $r[2], 'description' => $r[3], 'date_inscription' => $r[4] ); $siteTitle=htmlentities($_GET['params']); $siteDescription=htmlentities($_GET['params'])." bot details"; $mainSectionScript="../src/aboutBot.php"; $hist=get_battles_history($r[1]); $asideSectionContent='