<?php
require_once "../../maincore.php";
require_once THEMES."templates/header.php";
include INFUSIONS."sr/defined_db.php";
// Check if locale file is available matching the current site locale setting.
if (file_exists(INFUSIONS."sr/locale/".$settings['locale'].".php")) {
// Load the locale file matching the current site locale setting.
include INFUSIONS."sr/locale/".$settings['locale'].".php";
} else {
// Load the infusion's default locale file.
include INFUSIONS."sr/locale/English.php";
}
require "global_func.php";
//Defined Variables
$maxcars = $userdata['user_cars_ownedmax'];
$usermoneys = $userdata['user_money'];
$userid = $userdata['user_id'];
//Member Permissions
if (iMEMBER) {
$mpq = mysql_query("SELECT * FROM ".DB_HOUSES." WHERE house_carsmax='$maxcars'");
$mp = mysql_fetch_array($mpq);
$_GET['property'] = abs((int) $_GET['property']);
if ($_GET['property'])
{
opentable("Buy House");
$npq =
mysql_query("SELECT * FROM ".DB_HOUSES." WHERE house_id=".$_GET['property']."");
$np = mysql_fetch_array($npq);
if ($np['house_carsmax'] < $mp['house_carsmax'])
{
echo "You cannot downgrade in houses!";
}
else if ($np['house_price'] > $usermoneys)
{
echo "You do not have enough money to buy the ".$np['house_name']."";
}
else
{
mysql_query("UPDATE ".DB_USERS." SET user_money=money-".$np['house_price'].",user_cars_ownedmax=".$np['house_carsmax']." WHERE user_id=$userid");
echo "Congrats, you bought the ".$np['house_name']." for $hpf!";
}
closetable();
}
else if (isset($_GET['sellhouse']))
{
opentable("Sell House");
$npq =
mysql_query("SELECT * FROM ".DB_HOUSES." WHERE house_carsmax=".$userdata['user_cars_ownedmax']."");
$np = mysql_fetch_array($npq);
if ($maxcars == 1)
{
echo "You already live in the lowest property!";
}
else
{
mysql_query(
"UPDATE ".DB_USERS." SET user_cars_ownedmax=1 WHERE user_id=$userid");
echo "You sold your ".$np['house_name']." and went back to your shed.";
}
closetable();
}
else
{
opentable("Estates");
echo "</br><center>Your current property: <strong>".$mp['house_name']."</strong><br /><br />
<table><tr><th>House</th><th>House Price</th><th>Car Lot Size</th><th></th><th>Buy?</th></tr>";
if ($maxcars > 1)
{
echo "<a href='estate.php?sellhouse'>Sell Your House</a><br /><br />";
}
$hq =
mysql_query("SELECT * FROM ".DB_HOUSES." WHERE house_carsmax>$maxcars ORDER BY house_carsmax ASC");
while ($r = mysql_fetch_array($hq))
{
//Money Format
$hpf = money_formatter($r['house_price']);
echo "<tr><td>".$r['house_name']."</a></td><td>".$hpf."</td>
<td>Car Storage: ".$r['house_carsmax']." cars</td>
<td><a href='estate.php?property=".$r['house_id']."'><img src='images/houses/".$r['house_img']."' alt='".$r['house_name']."' style='width:100px;height:75px;'></img></td><td><a href='estate.php?property=".$r['house_id']."'>Buy</tr>";
}
}
echo "</table></center>";
closetable();
//Public
} else {
echo"Access Denied";
}
require_once THEMES."templates/footer.php";
?>
Category Forum
Modifications and Requests - 8Labels
None yet
Statistics
1 participant
Notifications
You are not receiving notifications from this thread.
Related Questions