Merge pull request #92 from gnieark/dev

Dev
This commit is contained in:
Gnieark 2016-06-16 13:47:19 +02:00 committed by GitHub
commit 5ecb64dd24
4 changed files with 16 additions and 5 deletions

@ -1 +1 @@
Subproject commit 7c8b786228bb9e1561ff60a2d6f7f6ce91be6fee Subproject commit 1d85f9ef3ecfc42bbc4f3c70d5e37ca9a65f629a

View File

@ -78,10 +78,20 @@ switch ($_POST['act']){
$playerResponse = -1; $playerResponse = -1;
} }
if($_POST['fullLogs'] == "true"){
$fullLogs='Arena send to '.$playerName.'<em>'.htmlentities($tempPlayer['messageSend']).'</em><br/>
HTTP status: <em>'.htmlentities($tempPlayer['httpStatus']).'</em><br/>
Bot anwser: <em>'.htmlentities($tempPlayer['response']).'</em><br/>';
}else{
$fullLogs='';
}
//tester la validité de la réponse //tester la validité de la réponse
if((isset($map[$playerResponse])) && ($map[$playerResponse]=="")){ if((isset($map[$playerResponse])) && ($map[$playerResponse]=="")){
//reponse conforme //reponse conforme
echo "<p>".$playerName." joue en ".$playerResponse." la nouvelle grille est <br/>"; echo "<p>".$fullLogs.$playerName." joue en ".$playerResponse." la nouvelle grille est <br/>";
$map[$playerResponse]=$playerCHAR; $map[$playerResponse]=$playerCHAR;
echo "<table>"; echo "<table>";
for($j=0;$j<3;$j++){ for($j=0;$j<3;$j++){

View File

@ -12,7 +12,7 @@ function Ajx(){
} }
return request; return request;
} }
function tictactoe(bot1,bot2,xd_check){ function tictactoe(bot1,bot2,xd_check,fullLogs){
document.getElementById('fightResult').innerHTML = '<p>Please wait...</p>'; document.getElementById('fightResult').innerHTML = '<p>Please wait...</p>';
var xhr = Ajx(); var xhr = Ajx();
xhr.onreadystatechange = function(){if(xhr.readyState == 4){ xhr.onreadystatechange = function(){if(xhr.readyState == 4){
@ -22,5 +22,5 @@ function tictactoe(bot1,bot2,xd_check){
}}; }};
xhr.open("POST", '/tictactoe', true); xhr.open("POST", '/tictactoe', true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.send('act=fight&bot1=' + bot1 + '&bot2=' + bot2 + '&xd_check=' + xd_check); xhr.send('act=fight&bot1=' + bot1 + '&bot2=' + bot2 + '&fullLogs=' + fullLogs + '&xd_check=' + xd_check);
} }

View File

@ -40,6 +40,7 @@ if(!$postParams){
?> ?>
</select> </select>
</p> </p>
<p><input type="button" value="<?php echo $lang['FIGHT']; ?>" onclick="tictactoe(document.getElementById('bot1').value,document.getElementById('bot2').value,'<?php echo xd_check_input(2); ?>');"></p> <p><input type="checkbox" id="fullLogs"/><label for="fullLogs">view the full logs</label></p>
<p><input type="button" value="<?php echo $lang['FIGHT']; ?>" onclick="tictactoe(document.getElementById('bot1').value,document.getElementById('bot2').value,'<?php echo xd_check_input(2); ?>',document.getElementById('fullLogs').checked);"></p>
<div id="fightResult"></div> <div id="fightResult"></div>
</article> </article>