<?
if(isset($_SESSION['harvest']))
{
harvest($_SESSION['harvest']);
unset($_SESSION['harvest']);
}
if(isset($_SESSION['rating']))
{
ratingg($_SESSION['rating']);
unset($_SESSION['rating']);
}
if($ku['umoney']!=0)
{
money($ku['umoney']);
}

if(isset($_SESSION['no_rubies']))
{
no_rubies($_SESSION['no_rubies']);
unset($_SESSION['no_rubies']);
}
if(isset($_SESSION['no_money']))
{
no_money($_SESSION['no_money']);
unset($_SESSION['no_money']);
}
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_mail` WHERE `id_user` = '$ku[id]' AND `read` = '0'"),0)!=0)
{
echo "<div class='feedback'><div>Новая почта <span class='title'>(<span>".mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_mail` WHERE `id_user` = '$ku[id]' AND `read` = '0'"),0)."</span>)</span><br><a href='?mail&new'>Читать</a><br></div></div>";
}
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_gifts` WHERE `id_user` = '$ku[id]' AND `read` = '0'"),0)!=0)
{
echo "<div class='feedback'><div>У вас новый подарок<br><a href='?presents=$ku[id]'>Смотреть</a><br></div></div>";
}
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_collective_invite` WHERE `id_user` = '$ku[id]'"),0)!=0)
{
$invite=mysql_fetch_array(mysql_query("SELECT * FROM `kolhoz_collective_invite` WHERE `id_user` = '$ku[id]'"));
$cti=mysql_fetch_array(mysql_query("SELECT * FROM `kolhoz_collective` WHERE `id` = '$invite[id_collective]'"));
$who=mysql_fetch_array(mysql_query("SELECT * FROM `kolhoz_user` WHERE `id` = '$invite[id_who]'"));
if(isset($_GET['invite_collective']) && $_GET['invite_collective']=='yes')
{
mysql_query("DELETE FROM `kolhoz_collective_invite` WHERE `id` = '$invite[id]'");
mysql_query("INSERT INTO `kolhoz_collective_user` SET `id_user` = '$ku[id]', `id_collective` = '$cti[id]', `time` = '$time', `status` = '7'");
mysql_query("INSERT INTO `kolhoz_collective_history` SET `id_user` = '$ku[id]', `id_who` = '$who[id]', `id_collective` = '$cti[id]', `time` = '$time', `type` = 'in', `dei` = 'who'");
header("Location:?collective=$cti[id]");
}
elseif(isset($_GET['invite_collective']) && $_GET['invite_collective']=='no')
{
mysql_query("DELETE FROM `kolhoz_collective_invite` WHERE `id` = '$invite[id]'");
}
else
{
echo "<div class='feedback'><div><span>";
echo on_k($who['id']);
echo " <a class='' href='?user=$who[id]'>".nc($who['id'])."</a></span> приглашает Вас в свой картель <a href='?collective=$cti[id]'><span>".hsc($cti['name'])."</span></a><br/>";
echo "<img width='16' height='16' src='images/icons/tick.png' alt='o'> <a href='?myfarm&invite_collective=yes'>Принять приглашение</a><br/>";
echo "<img width='16' height='16' src='images/icons/delete.png' alt='o'> <a href='?myfarm&invite_collective=no'>Отказаться</a>";
echo "</div>\n
</div>";
}
}

if(isset($_SESSION['msg']))
{
msg_game($_SESSION['msg']);
unset($_SESSION['msg']);
}
echo "<div class='block'><div style='text-align:right;'>Время: ".vremja($time)."</div></div>";
echo "<div class='block'><center><div class='headganja'><a href='?myfarm'><img width='16' height='16' src='images/icons/seat.png' alt='o'></a></div>
<div class='headganja'><a href='?mypetfarm'><img width='16' height='16' src='images/polka.png' alt='o'></a></div>
<div class='headganja'><a href='?myzavod'><img width='16' height='16' src='images/zavod/zavod.png' alt='o'></a></div>
<div class='headganja'><a href='?center'><img width='16' height='16' src='images/icons/center.png' alt='o'></a></div>
<div class='headganja'><a href='?converter'><img width='16' height='16' src='images/icons/converter.png' alt='o'></a></div>
<div class='headganja'><a href='?shop'><img width='16' height='16' src='images/icons/cart.png' alt='o'></a></div>
<div class='headganja'><a href='?online'><img width='16' height='16' src='images/icons/online.png' alt='o'></a></div>
<div class='headganja'><a href='?payment'><img width='16' height='16' src='images/icons/ruby.png' alt='o'></a></div>
<div class='headganja'><a href='?mail'><img width='16' height='16' src='images/icons/mails.png' alt='o'></a></div></center></div>";
if(isset($_SESSION['cp']))
{
echo "<div class='feedback'><ul class='feedbackPanel'><li class='feedbackPanelINFO'><span class='feedbackPanelINFO'>Бесплатная очистка плантаций будет доступна через ".time_left($ku['time_cp']-$time)."</span></div>";
unset($_SESSION['cp']);
}
$max = $level['rating'];
$tek = $kr;
$forl = ($tek/$max)*100;
echo '<div style="border:1px solid #55A855;margin-top:2px;">';
echo '<div class="expline" style="width:'.$forl.'%;"/>';
echo "</div>";
echo "</div>";
echo "</div>";
?>