It's the first time I'm implementing payments on my site.
I'd like to create a variable or auto-send a form that would make a variable or $_POST
variable that takes value TRUE
or FALSE
depending on payment status.
Below is my idea of doing it but inspecting the source code of site in develop mode we can still see "hidden" values in which I specified GET
variables (id) that would make it senseless because of lack of the variable that wouldn't be able to be changed by the user, now we can easily access the page xxx? id
and the whole code would run despite even not clicking the payment button. Have you got any ideas or schemes what's the way to solve my problem? Thanks.
FORM:
<form action="paypal...." method="post">
<input type="hidden" name="cmd" value="xxx">
<input type="hidden" name="business" value="xxxxx">
<input type="hidden" name="item_name" value="xxx">
<input type="hidden" name="currency_code" value="PLN">
<input type="hidden" name="amount" value="0.01">
<input type="hidden" name="return" value="http://xxx/xxx?id=xxxxxx">
<input type="hidden" name="item_name" value="<?=$x?>">
<input type="image" src="xxx" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
</form>
THE PAGE "xxx" in "return" input
$y=$_GET['id'];
header("Location: mecz?id=$y");
$osoba=$_GET['osoba'];
$osoba1=$_SESSION['zalogowany'];
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "SELECT ... FROM ... WHERE id='$y'";
$result = $conn->query($sql);
$row = $result->fetch_assoc();
$dobana = $row['ban'];
$dobana.=$_SESSION['zalogowany']." ";
if($_POST['unsign'])
{
$sql = "UPDATE ... SET $... ='',ban='$dobana' WHERE id='$y'";
}
else
{
$sql = "UPDATE ... SET $... ='$osoba1' WHERE id='$y'";
}
if ($conn->query($sql) === TRUE) {
echo "Dodano osobe!";
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}