function commune

This commit is contained in:
gnieark 2016-06-11 17:52:13 +02:00
parent 04604fd89b
commit 2a167a6b96
5 changed files with 29 additions and 40 deletions

BIN
html/imgs/Arenes-Nimes.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 550 KiB

View File

@ -1,4 +1,10 @@
<article>
<h2>Cette arène est en cours de maintenance, elle sera de nouveau prête dans les prochains jours</h2>
<p><img src="Arenes-Nimes.jpg" alt="travaux sur les arènes de Nimes"/></p>
</article>
<?php
/*
require_once(__DIR__."/functions.php");
$bots=get_Bots_Array('Battleship');
@ -52,4 +58,5 @@ if(!$postParams){
<!-- battleship(bot1,bot2,gridWidth,gridHeight,nbShip1,nbShip2,nbShip3,nbShip4,nbShip5,nbShip6,xd_check) -->
<p><label>&nbsp;</label><input type="button" value="<?php echo $lang['FIGHT']; ?>" onclick="battleship(document.getElementById('bot1').value,document.getElementById('bot2').value,getElementById('width').value,getElementById('height').value,getElementById('ship1').value,getElementById('ship2').value,getElementById('ship3').value,getElementById('ship4').value,getElementById('ship5').value,getElementById('ship6').value,'<?php echo xd_check_input(2); ?>');"></p>
<div id="fightResult"></div>
</article>
</article
*/>

View File

@ -1,23 +1,4 @@
<?php
function get_IA_Response($iaUrl,$postParams){
//send params JSON as body
$data_string = json_encode($postParams);
$ch = curl_init($iaUrl);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Content-Length: ' . strlen($data_string))
);
$output= curl_exec($ch);
curl_close($ch);
//echo $iaUrl." ".$data_string." ".$output.'<br/>';
return json_decode($output,TRUE);
}
function get_Post_Params($botsCount){
$keysBots=array('bot1','bot2');
foreach($keysBots as $botKey){

View File

@ -34,23 +34,3 @@ function get_Bots_Array(){
return $bots;
}
*/
function get_IA_Response($iaUrl,$postParams){
//send params JSON as body
$data_string = json_encode($postParams);
$ch = curl_init($iaUrl);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Content-Length: ' . strlen($data_string))
);
$output= curl_exec($ch);
curl_close($ch);
//echo $iaUrl." ".$data_string." ".$output.'<br/>';
return json_decode($output,TRUE);
}

View File

@ -331,4 +331,25 @@ function does_arena_exist($string,$arenasArr){
}
}
return false;
}
function get_IA_Response($iaUrl,$postParams){
//send params JSON as body
$data_string = json_encode($postParams);
$ch = curl_init($iaUrl);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Content-Length: ' . strlen($data_string))
);
$output= curl_exec($ch);
curl_close($ch);
//echo $iaUrl." ".$data_string." ".$output.'<br/>';
return json_decode($output,TRUE);
}