check game ID on AJAX communications

This commit is contained in:
gnieark 2016-06-12 01:14:56 +02:00
parent ab4cd8eb3a
commit 92db3755c5
2 changed files with 9 additions and 3 deletions

View File

@ -67,10 +67,13 @@ switch ($_POST['act']){
case "fight":
if(($_SESSION['game'] <> "connectFou") || ((!$new) && ($_POST['gameId'] <> $_SESSION['matchId']))){
error(500,"game non found");
if($_SESSION['game'] <> "connectFou"){
error(500,"game non found");
die;
}
if((!$new) && ($_POST['gameId'] <> $_SESSION['matchId'])){
error (512, "not correct gameId");
}
//What player has to play?
if(!isset($_SESSION['currentPlayer'])){

View File

@ -80,6 +80,9 @@ function connectFour(bot1,bot2,xd_check, gameId, newGame){
if(reponse['continue'] == 1){
connectFour(bot1,bot2,xd_check,reponse['gameId'], false);
}
}else if(xhr.status == 512){
//just forget
return;
}else{
alert ('error ' + xhr.status);
return;