$p[2]) ) { error(500,'wrong parameters'); die; } $postValues[$p[0]]=$value; } //check if bots exists $bot1Exists = false; $bot2Exists = false; foreach($bots as $bot){ if($bot['id'] == $_POST['bot1']){ $bot1 = $bot; $bot1Exists =true; } if($bot['id'] == $_POST['bot2']){ $bot2 = $bot; $bot2Exists =true; } if ($bot1Exists && $bot2Exists){ break; } } if ((!$bot1Exists) OR (!$bot2Exists)){ error (500,"missing parameter"; } //vars checked, lets init the initGame $_SESSION['matchId']=get_unique_id(); break; default: break; }