This commit is contained in:
Gnieark 2015-11-28 15:57:35 +01:00
parent b30535ebfc
commit 3411394103
3 changed files with 4 additions and 4 deletions

View File

@ -6,7 +6,7 @@ switch ($_POST['act']){
case "fight":
$bots=get_Bots_Array();
//clean $_POST vars
$postParams=get_Post_Params();
$postParams=get_Post_Params(count($bots));
if(!$postParams){
error(400,"wrong parameters send");
die;

View File

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

View File

@ -2,7 +2,7 @@
require_once(__DIR__."/functions.php");
$bots=get_Bots_Array();
$postParams=get_Post_Params();
$postParams=get_Post_Params(count($bots));
if(!$postParams){
$bot1="";
$bot2="";