battle ship functions
This commit is contained in:
parent
2c033e19cd
commit
bed6efdf44
17
src/arenas/Battleship/functions.php
Normal file
17
src/arenas/Battleship/functions.php
Normal 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']);
|
||||
}
|
Loading…
Reference in New Issue
Block a user