I am working on this for the past 1 hour, and I cant get it working... So, I changed my code to see what he outputs, here is the code changed:
<?php
include('../assets/class/usercount.class.php');
include('../assets/class/count.class.php');
include('../assets/class/user.class.php');
include('../assets/class/userupdate.class.php');
$select = $_POST['pick'];
if ($select == 'heads') {
$select = '1';
} elseif ($select == 'tails') {
$select = '2';
}
$amount = $_POST['amount'];
$balancee = $_SESSION['balance'];
$amountt = $amount - '1';
echo $_POST['pick'] . '<br />' . $select . '<br />' . $amount . '<br >' . $balancee;
?>
As output I get:
heads 1 100 773
That is good, but when I do my whole script on it:
<?php
include('../assets/class/usercount.class.php');
include('../assets/class/count.class.php');
include('../assets/class/user.class.php');
include('../assets/class/userupdate.class.php');
$select = $_POST['pick'];
if ($select == 'heads') {
$select = '1';
} elseif ($select == 'tails') {
$select = '2';
}
$amount = $_POST['amount'];
$balancee = $_SESSION['balance'];
$amountt = $amount - '1';
if (is_nummeric($amountt)) {
if ($balancee > $amountt) {
$amount = $amountt + '1';
$num = rand(1, 2);
if ($num == $select) {
$amountt = $amount * '2';
$balance = $balancee + $amountt;
update($_SESSION['id'], 'balance', $balance);
aaron('won', 'up', $amountt);
header("Location: coinflip.php?message=You have won $amount R$! Your balance is now $balance R$!");
die();
} elseif ($num != $select) {
$balance = $balancee - $amount;
update($_SESSION['id'], 'balance', $balance);
header("Location: coinflip.php?message=You have lost $amount R$. Your balance is now $balance R$");
die();
} else {
header("Location: coinflip.php?message=Your input is wrong!");
die();
}
} else {
$amount = $amount + 1;
header("Location: coinflip.php?message=Not enough balance! you need $amount R$, you have $balance R$!");
die();
}
} else {
header("Location: coinflip.php?message=Your input is wrong!");
die();
}
?>
Then I get a HTTP error 500, please help me! I am working on this for hours and still nothing works. I cant find the solution :(