Findd Online
New member
I guess you can call this a banking system. But this is my problem I want to make not allowable to purchase stuff if it would make your points go below zero but how? You can see that around...
$row = mysql_fetch_assoc($Select_Users);
if($row['points'] < $Change_Points)
{
die("You can afford that!");
}
Is where I messed up! What did I do wrong because it still allows money transfers that will make your account negative??????
<?php
//Variables
$Ad_Day = $_POST['day'];
$Product = $_POST['product'];
$Now = date("y/m/d");
$Username = $_SESSION['username'];
$Password = $_SESSION['password'];
if($Ad_Day == "1day")
{
$Points = '1';
}
if($Ad_Day == "2day")
{
$Points = '2';
}
if($Ad_Day == "3day")
{
$Points = '3';
}
if($Ad_Day == "4day")
{
$Points = '4';
}
if($Ad_Day == "10day")
{
$Points = '10';
}
if($Ad_Day == "30day")
{
$Points = '30';
}
if($Ad_Day == "360day")
{
$Points = '360';
}
$End = mktime(0,0,0,date("m"),date("d")+$Ad_Day,date("Y"));
$End2 = date("Y-m-d", $End);
$Change = mysql_query("UPDATE products
SET adfinish='$End2'
WHERE title='$Product' AND owner='$Username'");
$Select_Users = mysql_query("SELECT * FROM users WHERE username='$Username' AND password='$Password'");
$Change_Points = mysql_query("UPDATE users
SET points= points - '$Points'
WHERE username='$Username' AND password='$Password'");
$row = mysql_fetch_assoc($Select_Users);
if($row['points'] < $Change_Points)
{
die("You can afford that!");
}
if(!$Change || !$Change_Points)
{
echo mysql_error();
die("Opps! We ran into an error this error has been reported and will soon be fixed." .
mail("email","Error","Error on page quick_finish.php","From: Findd Online"));
}
else
{
echo "Your transaction work successfully!";
}
?>
$row = mysql_fetch_assoc($Select_Users);
if($row['points'] < $Change_Points)
{
die("You can afford that!");
}
Is where I messed up! What did I do wrong because it still allows money transfers that will make your account negative??????
<?php
//Variables
$Ad_Day = $_POST['day'];
$Product = $_POST['product'];
$Now = date("y/m/d");
$Username = $_SESSION['username'];
$Password = $_SESSION['password'];
if($Ad_Day == "1day")
{
$Points = '1';
}
if($Ad_Day == "2day")
{
$Points = '2';
}
if($Ad_Day == "3day")
{
$Points = '3';
}
if($Ad_Day == "4day")
{
$Points = '4';
}
if($Ad_Day == "10day")
{
$Points = '10';
}
if($Ad_Day == "30day")
{
$Points = '30';
}
if($Ad_Day == "360day")
{
$Points = '360';
}
$End = mktime(0,0,0,date("m"),date("d")+$Ad_Day,date("Y"));
$End2 = date("Y-m-d", $End);
$Change = mysql_query("UPDATE products
SET adfinish='$End2'
WHERE title='$Product' AND owner='$Username'");
$Select_Users = mysql_query("SELECT * FROM users WHERE username='$Username' AND password='$Password'");
$Change_Points = mysql_query("UPDATE users
SET points= points - '$Points'
WHERE username='$Username' AND password='$Password'");
$row = mysql_fetch_assoc($Select_Users);
if($row['points'] < $Change_Points)
{
die("You can afford that!");
}
if(!$Change || !$Change_Points)
{
echo mysql_error();
die("Opps! We ran into an error this error has been reported and will soon be fixed." .
mail("email","Error","Error on page quick_finish.php","From: Findd Online"));
}
else
{
echo "Your transaction work successfully!";
}
?>