integers must be integers (checker added)
This commit is contained in:
parent
1f06924bf2
commit
c1cad30a9e
@ -18,9 +18,9 @@ if ($user['battle'] != 0) {
|
||||
|
||||
$get = urldecode(filter_input(INPUT_SERVER, 'QUERY_STRING'));
|
||||
|
||||
$itemCost = (int)filter_input(INPUT_GET, $_GET['kredit'], FILTER_VALIDATE_INT, ['options' => ['min_range' => 1]]);
|
||||
$itemId = (int)filter_input(INPUT_GET, $_GET['n'], FILTER_VALIDATE_INT, ['options' => ['min_range' => 1]]);
|
||||
$returningItemId = (int)filter_input(INPUT_GET, $_GET['back'], FILTER_VALIDATE_INT, ['options' => ['min_range' => 1]]);
|
||||
$itemCost = checkIntInRange($_GET['kredit']);
|
||||
$itemId = checkIntInRange($_GET['n']);
|
||||
$returningItemId = checkIntInRange($_GET['back']);
|
||||
|
||||
if ($itemCost && $itemId) {
|
||||
$commission = ceil($itemCost / 10); # 10% от суммы с округлением вверх.
|
||||
|
@ -2824,3 +2824,8 @@ function addOnePoint($name, $param = null)
|
||||
} else echo "<span style='color: maroon;'>Ошибка: параметр достиг максимального значения!</span>";
|
||||
} else return null;
|
||||
}
|
||||
|
||||
function checkIntInRange($int, $min = 1, $max = PHP_INT_MAX)
|
||||
{
|
||||
return (int)filter_var($int, FILTER_VALIDATE_INT, ['options' => ['min_range' => $min,'max_range' => $max]]);
|
||||
}
|
Loading…
Reference in New Issue
Block a user