This commit is contained in:
Gnieark 2016-05-10 17:05:09 +02:00
parent e036bd55da
commit 910142f0d2
3 changed files with 41 additions and 6 deletions

View File

@ -3,12 +3,23 @@
require_once(__DIR__."/functions.php");
switch ($_POST['act']){
case "newfight":
//initialiser la map
$_SESSION['map']=array(
array("","","","","","",""),
array("","","","","","",""),
array("","","","","","",""),
array("","","","","","",""),
array("","","","","","",""),
array("","","","","","",""),
);
echo json_encode($_SESSION['map']);
case "fight":
break;
die;
break;
default:
break;
}

View File

@ -1,4 +1,5 @@
<?php
function get_Post_Params($botsCount){
$keysBots=array('bot1','bot2');
foreach($keysBots as $botKey){

View File

@ -1,3 +1,26 @@
function Ajx(){
var request = false;
try {request = new ActiveXObject('Msxml2.XMLHTTP');}
catch (err2) {
try {request = new ActiveXObject('Microsoft.XMLHTTP');}
catch (err3) {
try { request = new XMLHttpRequest();}
catch (err1) {
request = false;
}
}
}
return request;
}
function connectFour(bot1,bot2,xd_check){
}
document.getElementById('fightResult').innerHTML = '<p>Please wait...</p>';
var xhr = Ajx();
xhr.onreadystatechange = function(){if(xhr.readyState == 4){
if(xhr.status == 200) {
document.getElementById('fightResult').innerHTML = xhr.responseText;
}
}};
xhr.open("POST", '/connectFour', true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.send('act=newFight&bot1=' + bot1 + '&bot2=' + bot2 + '&xd_check=' + xd_check);
}