<?
require "../../configmain.php";
require "../../global.php";
connectdb();?>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF">
<p><b><?
if ($banner == '1'){
echo $bannercode;
}
?>Some check's are being performed</b><br>
<br>
<?
$useram = mysql_query("SELECT * FROM usr WHERE usr ='$user'");
$usera = mysql_fetch_array($useram);
$costm = mysql_query("SELECT cost, money FROM towns WHERE tid ='$town'");
$cost = mysql_fetch_array($costm);
$buildl = mysql_query("SELECT * FROM buildinglocation WHERE horz='$horz' and vert='$vert' and town ='$town'");
$buildloc = mysql_fetch_array($buildl);
if ($usera[1] != $password){
echo "incorrect password please log in again";
}
if ($usera[1] == $password){
if ($usera[9] <= $cost[0]){
echo "Not enough money to purchase land<br>You have $usera[9] money but the area costs $cost[0]<br>";
}
if ($usera[9] >= $cost[0]){
echo "You have enough money to buy the land<br>";
$owner=$buildloc[4];
$owner2 = $owner;
if ($owner2 == ''){
$buildch = mysql_query("SELECT * FROM buildinglocation WHERE usr='$user' and buid='0'");
$nobd='0';
while($buildc = mysql_fetch_array($buildch)){
$nobd=$nobd+'1';
}
if($nobd<='3'){
$res = mysql_query("INSERT INTO buildinglocation VALUES('$town','$vert','$horz',0,'$user',0,0,0,0,0,0,0)");
$umoney = $usera[9] - $cost[0];
$res2 = mysql_query("UPDATE usr SET money='$umoney' where usr='$user'");
$mmoney = $cost[0] + $cost[1];
$res3 = mysql_query("UPDATE towns SET money='$mmoney' where tid='$town'");
echo "Congratulations, you have bought this land<br>";
}
if($nobd>='4'){
echo "You already have 3 constructions site's, please use them first";
}
}
if ($owner2 != ''){
echo "Some one owns this land, maybe you were to late to buy the land<br>";
}
}
}
?> <br>
<a href="/world/location.php?&map=<?echo $town;?>&vert=<?echo $vert;?>&horz=<?echo $horz;?>">Return
to the building location</a><br>
<a href="/world/town.php?&map=<?echo $town;?>"">Return
to the town map </a></p>
</body>
</html>