battle ship functions

This commit is contained in:
gnieark 2015-12-10 20:53:13 +01:00
parent 2c033e19cd
commit bed6efdf44

View File

@ -0,0 +1,17 @@
<?php
function get_Post_Params($botsCount){
$keysBots=array('bot1','bot2');
foreach($keysBots as $botKey){
if(!isset($_POST[$botKey])){
return false;
}
if(!is_numeric(($_POST[$botKey]))){
}
if(($_POST[$botKey] < 0) OR ($_POST[$botKey] > $botsCount)){
error(400,"wrong parameters");
die;
}
}
return array('bot1' => $_POST['bot1'],'bot2' => $_POST['bot2']);
}