Code: Select all
<?php
///////////////////////////////////////////////////BEGINNING OF GOLD INCOME BUSINESSES////////////////////////////////////////////////
//user buys a business Fruit Stand//
if(isset($_POST['business'])){
$fruit = protect($_POST['fruit']);
$gold_needed = (($business['fruit'] * 1) * $fruit);
if($fruit < 0){
output("You must purchase a positive number of Fruit Stands!");
}elseif($stats['gold'] < $gold_needed){
output("You do not have enough gold!");
}else{
$business['fruit'] += $fruit;
$update_business = mysql_query("UPDATE `business` SET `fruit`='".$business['fruit']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysql_error());
$stats['gold'] -= $gold_needed;
$update_gold = mysql_query("UPDATE `stats` SET `gold`='".$stats['gold']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysql_error());
include("update_businesses.php");
output("You have purchased Fruit Stands!");
}
}
//user buys a business Tire Shop//
if(isset($_POST['business'])){
$tire = protect($_POST['tire']);
$gold_needed = (($business['tire'] * 2) * $tire);
if($tire < 0){
output("You must purchase a positive number of Tire Shops!");
}elseif($stats['gold'] < $gold_needed){
output("You do not have enough gold!");
}else{
$business['tire'] += $tire;
$update_business = mysql_query("UPDATE `business` SET `tire`='".$business['tire']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysql_error());
$stats['gold'] -= $gold_needed;
$update_gold = mysql_query("UPDATE `stats` SET `gold`='".$stats['gold']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysql_error());
include("update_businesses.php");
output("You have purchased businesses!");
}
}
//user buys a business Parts Store//
if(isset($_POST['business'])){
$parts = protect($_POST['parts']);
$gold_needed = (($business['parts'] * 5) * $parts);
if($parts < 0){
output("You must purchase a positive number of Part Stores!");
}elseif($stats['gold'] < $gold_needed){
output("You do not have enough gold!");
}else{
$business['parts'] += $parts;
$update_business = mysql_query("UPDATE `business` SET `parts`='".$business['parts']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysql_error());
$stats['gold'] -= $gold_needed;
$update_gold = mysql_query("UPDATE `stats` SET `gold`='".$stats['gold']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysql_error());
include("update_businesses.php");
output("You have purchased businesses!");
}
}
//user buys a business Chop Shop//
if(isset($_POST['business'])){
$chop = protect($_POST['chop']);
$gold_needed = (($business['chop'] * 10) * $chop);
if($chop < 0){
output("You must purchase a positive number of Chop Shops!");
}elseif($stats['gold'] < $gold_needed){
output("You do not have enough gold!");
}else{
$business['chop'] += $chop;
$update_business = mysql_query("UPDATE `business` SET `chop`='".$business['chop']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysql_error());
$stats['gold'] -= $gold_needed;
$update_gold = mysql_query("UPDATE `stats` SET `gold`='".$stats['gold']."' WHERE `id`='".$_SESSION['uid']."'") or die(mysql_error());
include("update_businesses.php");
output("You have purchased businesses!");
}
///////////////////////////////////////////////////END OF GOLD INCOME BUSINESSES////////////////////////////////////////////////
?>