So, I have created some code in php, and now I want to know if its "secure enough". This is the code:
$amount = $_POST['amount'];
if ($amount < 1) { die("Min amount is 1."); }
if ($amount > 20) { die("Max amount is 20."); }
// More stuff here
Is it possible, to for example somehow get the $amount
set to 50, and still let it work? After this it will send a file_get_contents
to a webpage with the number, for example: https://example.com/amount.php?a=15
. Is it possible to get that 15 to be 50 at the "More stuff here" part.
I'm just curious, that's all.
EDITS
Here is the html Im using;
<form method="POST">
<input type="number" class="form-control form-control-user" id="amount" name="amount" min="1" max="20" value="1"><br>
<button class="btn btn-success" type="submit">send</button>
</form>
Then this is my full php (for example)
if (isset($_POST['amount'])) {
$amount = $_POST['amount'];
if ($amount < 1) { die("Min amount is 1."); }
if ($amount > 20) { die("Max amount is 20."); }
$conn->query("INSERT INTO my_table (amount) VALUES ('$amount')");
file_get_contents("https://example.com/file.php?a=".$amount); // POINT A
}
Is it somehow possible to send at "POINT A" a other number? Like 50
?