RevCMS lottery script

Status
Not open for further replies.
It redirects me to:

/me?Error?=Balance

Even if I had 10000000+ credits -,-

My lottery2 shows
##->Inserting values in database $cost = '5000'; // How much each lottery ticket will cost // Grabbing the POST'ed figures $Figure_1 = mysql_real_escape_string($_POST["Figure_1"]); $Figure_2 = mysql_real_escape_string($_POST["Figure_2"]); $Figure_3 = mysql_real_escape_string($_POST["Figure_3"]); $userCoins = "" . $_SESSION['user']['credits'] . ""; // If users coins are below the lottery cost, we'll send the header as an error if($userCoins < $cost) { Header("Location: me?Error?=Balance"); } else { // Taking away the cost of lottery to the users account $coins = mysql_query("UPDATE `users` SET `credits` = credits - ". $cost ." WHERE username = '" . $_SESSION['user']['username'] . "'"); // Inserting the values into database, we'll send the header as successful $sql = mysql_query("INSERT INTO `lottery` (Username, Figure_1, Figure_2, Figure_3) VALUES ('". $_SESSION['user']['username'] ."', '". $Figure_1 . "', '". $Figure_2 . "', '". $Figure_3 .")"); Header("Location: me?successful"); }

Place

In front of that code and
At last of the code!
 
Status
Not open for further replies.
Back