<div class="cl-right">
<div class="s-bk-lf">
	
</div>
<div class="s-bk-lf">
	<div class="hst-title">Ферма</div>
</div>
На ферме живут ваши животные и дают продукцию, которую вы можете собирать и продавать на рынке. Вы можете собирать продукцию в любое время, она никуда не исчезает.
<BR />
<BR />
<?PHP
$_OPTIMIZATION["title"] = "Аккаунт - Ферма";
$usid = $_SESSION["user_id"];

$db->Query("SELECT * FROM db_users_b WHERE id = '$usid' LIMIT 1");
$user_data = $db->FetchArray();

$db->Query("SELECT * FROM db_config WHERE id = '1' LIMIT 1");
$sonfig_site = $db->FetchArray();

	if(isset($_POST["sbor"])){
	
		if($user_data["last_sbor"] < (time() - 600) ){
		
			$tomat_s = $func->SumCalc($sonfig_site["a_in_h"], $user_data["a_t"], $user_data["last_sbor"]);
			$straw_s = $func->SumCalc($sonfig_site["b_in_h"], $user_data["b_t"], $user_data["last_sbor"]);
			$pump_s = $func->SumCalc($sonfig_site["c_in_h"], $user_data["c_t"], $user_data["last_sbor"]);
			$peas_s = $func->SumCalc($sonfig_site["d_in_h"], $user_data["d_t"], $user_data["last_sbor"]);
			$pean_s = $func->SumCalc($sonfig_site["e_in_h"], $user_data["e_t"], $user_data["last_sbor"]);
			
			$db->Query("UPDATE db_users_b SET 
			a_b = a_b + '$tomat_s', 
			b_b = b_b + '$straw_s', 
			c_b = c_b + '$pump_s', 
			d_b = d_b + '$peas_s', 
			e_b = e_b + '$pean_s', 
			all_time_a = all_time_a + '$tomat_s',
			all_time_b = all_time_b + '$straw_s',
			all_time_c = all_time_c + '$pump_s',
			all_time_d = all_time_d + '$peas_s',
			all_time_e = all_time_e + '$pean_s',
			last_sbor = '".time()."' 
			WHERE id = '$usid' LIMIT 1");
			
			echo "<center><font color = 'green'><b>Вы собрали урожай</b></font></center><BR />";
			
			$db->Query("SELECT * FROM db_users_b WHERE id = '$usid' LIMIT 1");
			$user_data = $db->FetchArray();
			
		}else echo "<center><font color = 'red'><b>Урожай можно собирать не чаще 1го раза за 10 минут</b></font></center><BR />";
	
	}



							
?>

<form action method="post">
<table align="center">
	<tbody><tr>
		<td>
		<div class="fermadiv"> 
		<table align="center">
			<tbody><tr>
				<td align="center" width="150"><img src="/img/zver/fermakur.png"></td>
			<td align="center" width="120"><span class="naz">Количество</span><br><span class="h-ferm"><?=$user_data["a_t"]; ?></span></td>
				<td align="center" width="110">&nbsp;</td>
				<td align="center" width="100"><img src="/img/zver/ico.png"></td>
				<td align="center" width="120"><span class="naz">Яйца</span><br>
				<span class="h-ferm"><font color="#000"> <?=$func->SumCalc($sonfig_site["a_in_h"], $user_data["a_t"], $user_data["last_sbor"]);?> </font></</span></td>
			</tr>
		</tbody></table>
		</div>
		</td>
	</tr>

	<tr>
		<td>
		<div class="fermadiv"> 
		<table align="center">
			<tbody><tr>
				<td align="center" width="150"><img src="/img/zver/fermasvin.png"></td>
			<td align="center" width="120"><span class="naz">Количество</span><br><span class="h-ferm"><?=$user_data["b_t"]; ?></span></td>
				<td align="center" width="110">&nbsp;</td>
				<td align="center" width="100"><img src="/img/zver/maso.png"></td>
				<td align="center" width="120"><span class="naz">Мясо</span><br>
				<span class="h-ferm"><font color="#000"> <?=$func->SumCalc($sonfig_site["b_in_h"], $user_data["b_t"], $user_data["last_sbor"]);?> </font></span></td>
			</tr>
		</tbody></table>
		</div>
		</td>
	</tr>

	<tr>
		<td>
		<div class="fermadiv"> 
		<table align="center">
			<tbody><tr>
				<td align="center" width="150"><img src="/img/zver/fermakoza.png"></td>
			<td align="center" width="120"><span class="naz">Количество</span><br><span class="h-ferm"><?=$user_data["c_t"]; ?></span></td>
				<td align="center" width="110">&nbsp;</td>
				<td align="center" width="100"><img src="/img/zver/moloko.png"></td>
				<td align="center" width="120"><span class="naz">Молоко</span><br>
				<span class="h-ferm"><font color="#000"> <?=$func->SumCalc($sonfig_site["c_in_h"], $user_data["c_t"], $user_data["last_sbor"]);?> </font></span></td>
			</tr>
		</tbody></table>
		</div>
		</td>
	</tr>

	<tr>
		<td>
		<div class="fermadiv"> 
		<table align="center">
			<tbody><tr>
				<td align="center" width="150"><img src="/img/zver/fermaovca.png"></td>
				<td align="center" width="120"><span class="naz">Количество</span><br><span class="h-ferm"><?=$user_data["d_t"]; ?></span></td>
				<td align="center" width="110">&nbsp;</td>
				<td align="center" width="100"><img src="/img/zver/vata.png"></td>
				<td align="center" width="120"><span class="naz">Шерсть</span><br>
				<span class="h-ferm"><font color="#000"> <?=$func->SumCalc($sonfig_site["d_in_h"], $user_data["d_t"], $user_data["last_sbor"]);?> </font></span></td>
			</tr>
		</tbody></table>
		</div>
		</td>
	</tr>

	<tr>
		<td>
		<div class="fermadiv"> 
		<table align="center">
			<tbody><tr>
				<td align="center" width="150"><img src="/img/zver/fermakor.png"></td>
				<td align="center" width="120"><span class="naz">Количество</span><br><span class="h-ferm"><?=$user_data["e_t"]; ?></span></td>
				<td align="center" width="110">&nbsp;</td>
				<td align="center" width="100"><img src="/img/zver/masog.png"></td>
				<td align="center" width="120"><span class="naz">Мясо</span><br>
				<span class="h-ferm"><font color="#000"> <?=$func->SumCalc($sonfig_site["e_in_h"], $user_data["e_t"], $user_data["last_sbor"]);?> </font></span></td>
			</tr>
		</tbody></table>
		</div>
		</td>
	</tr>

	<tr>
		<td>&nbsp;</td>
	</tr>
	<tr>
		<td><center><input type="submit" name="sbor" value="Собрать все" class="btn_sobr"></center></td>
	</tr>
</tbody></table>
</form><br>



<table align="center" background="/img/sklad.png" width="600" height="451">
	<tbody><tr>
		<td valign="bottom">
		<table align="center">
			<tbody><tr>
				<td align="center" width="120"><img src="/img/zver/ico.png"></td>
				<td align="center" width="120"><img src="/img/zver/maso.png"></td>
				<td align="center" width="120"><img src="/img/zver/moloko.png"></td>
			</tr>
			<tr>
				<td align="center" width="120"><span class="h-ferm"><?=$user_data["a_b"]; ?></span></td>
				<td align="center" width="120"><span class="h-ferm"><?=$user_data["b_b"]; ?></span></td>
				<td align="center" width="120"><span class="h-ferm"><?=$user_data["c_b"]; ?></span></td>
			</tr>
		</tbody></table>
		</td>
	</tr>
	<tr>
		<td valign="top">
		<table align="center">
			<tbody><tr>
				<td align="center" width="120"><img src="/img/zver/vata.png"></td>
				<td align="center" width="120"><img src="/img/zver/masog.png"></td>
			</tr>
			<tr>
				<td align="center" width="120"><span class="h-ferm"><?=$user_data["d_b"]; ?></span></td>
				<td align="center" width="120"><span class="h-ferm"><?=$user_data["e_b"]; ?></span></td>
			</tr>
		</tbody></table>
		</td>
	</tr>
</tbody></table>

<div class="clr"></div>
</div>
