fix
This commit is contained in:
parent
b30535ebfc
commit
3411394103
|
@ -6,7 +6,7 @@ switch ($_POST['act']){
|
||||||
case "fight":
|
case "fight":
|
||||||
$bots=get_Bots_Array();
|
$bots=get_Bots_Array();
|
||||||
//clean $_POST vars
|
//clean $_POST vars
|
||||||
$postParams=get_Post_Params();
|
$postParams=get_Post_Params(count($bots));
|
||||||
if(!$postParams){
|
if(!$postParams){
|
||||||
error(400,"wrong parameters send");
|
error(400,"wrong parameters send");
|
||||||
die;
|
die;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
function get_Post_Params(){
|
function get_Post_Params($botsCount){
|
||||||
$keysBots=array('bot1','bot2');
|
$keysBots=array('bot1','bot2');
|
||||||
foreach($keysBots as $botKey){
|
foreach($keysBots as $botKey){
|
||||||
if(!isset($_POST[$botKey])){
|
if(!isset($_POST[$botKey])){
|
||||||
|
@ -8,7 +8,7 @@ function get_Post_Params(){
|
||||||
if(!is_numeric(($_POST[$botKey]))){
|
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");
|
error(400,"wrong parameters");
|
||||||
die;
|
die;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
require_once(__DIR__."/functions.php");
|
require_once(__DIR__."/functions.php");
|
||||||
|
|
||||||
$bots=get_Bots_Array();
|
$bots=get_Bots_Array();
|
||||||
$postParams=get_Post_Params();
|
$postParams=get_Post_Params(count($bots));
|
||||||
if(!$postParams){
|
if(!$postParams){
|
||||||
$bot1="";
|
$bot1="";
|
||||||
$bot2="";
|
$bot2="";
|
||||||
|
|
Loading…
Reference in New Issue
Block a user