<?
echo "<ul class='block'>";
$rat['width']=100/($level['rating']/$kr); $rat=floor($rat['width']); echo'<div style="border:1px solid #55A855; border-radius:7px;margin-top:1px;"><div class="expline" style="width:'.$rat.'%;"></div></div></div></li>';
echo '</ul></div></div>';
echo "</div>";
echo "</div>";
echo "<ul class='block'>";
echo "<li>";
echo "<img width='16' height='16' src='images/icons/plants.png' alt='o'> <a href='?myfarm'>Грядки</a> ".(mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_ground` WHERE `id_user` = '$ku[id]' AND (`id_plant` = '0' OR `time_water` = '$time' OR `time` = '$time' OR `time_water` < '$time' OR `time` < '$time' OR (`time_soil` = '$time' AND `soil` = '0') OR (`time_soil` < '$time' AND `soil` = '0'))"),0)!=0?"<span class='title'>(".mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_ground` WHERE `id_user` = '$ku[id]' AND (`id_plant` = '0' OR `time_water` = '$time' OR `time` = '$time' OR `time_water` < '$time' OR `time` < '$time' OR (`time_soil` = '$time' AND `soil` = '0') OR (`time_soil` < '$time' AND `soil` = '0'))"),0).")</span>":null)."</li>";
{
$count_mon=mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_petground` WHERE `id_user` = '$ku[id]' AND `id_pet` != '0' AND (`time_money` = '$time' OR `time_money` < '$time')"),0);
$q=mysql_query("SELECT * FROM `kolhoz_petground` WHERE `id_user` = '$ku[id]' AND `id_pet` != '0'");
$count_gol=0;
while($post=mysql_fetch_array($q))
{
$max_time=$time+$post['level']*(3600*4);
$mezh_time=$max_time-$post['time'];
if($mezh_time>=4*3600)$count_gol++;
}
$q=mysql_query("SELECT * FROM `kolhoz_petground` WHERE `id_user` = '$ku[id]' AND `id_pet` != '0'");
$count_mon=0;
while($post=mysql_fetch_array($q))
{
$d_money=floor($post['time_money2']/(4*3600));
if($d_money>0)$count_mon++;
}
if($count_gol>$count_mon)$count_zag=$count_mon;else $count_zag=$count_mon;
if($ku['level']>=10)echo "<li><img width='16' height='16' src='images/icons/animal.png' alt='o'> <a href='?mypetfarm'>Загоны</a> ".($count_zag?"<span class='title'>($count_zag)</span>":null)."</li>";
}
if($ku['level']>=10)echo "<img width='16' height='16' src='images/icons/last_recipes.png' alt='o'> <a href='?mycellar'>Погреб</a> ".(mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_polka` WHERE `id_user` = '$ku[id]' AND (`id_plant2` = '0' OR `time_water2` = '$time' OR `time` = '$time' OR `time_water2` < '$time' OR `time` < '$time' OR (`time_soil2` = '$time' AND `soil2` = '0') OR (`time_soil2` < '$time' AND `soil2` = '0'))"),0)!=0?"<span class='title'>(".mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_polka` WHERE `id_user` = '$ku[id]' AND (`id_plant2` = '0' OR `time_water2` = '$time' OR `time` = '$time' OR `time_water2` < '$time' OR `time` < '$time' OR (`time_soil2` = '$time' AND `soil2` = '0') OR (`time_soil2` < '$time' AND `soil2` = '0'))"),0).")</span>":null)."</li>";
if($ku['level']>=40)echo '<li><img width="16" height="16" src="images/icons/water.png" alt="o"> <a href="?myprud">Пруды</a></li>';
echo '<li><img width="16" height="16" src="images/icons/warehouse.png" alt="o"> <a href="?warehouse">Амбар</a></li>';
echo '<li><img width="16" height="16" src="images/icons/rinok.png" alt="o"> <a href="?market">Рынок</a></li>';
echo '<li><img width="16" height="16" src="images/icons/cart.png" alt="o"> <a href="?shop">Магазин</a></li>';
echo '<li><img width="16" height="16" src="images/icons/center.png" alt="o"> <a href="?center">Город</a></li>';
echo '<li class="pt"><img alt="" width="16" height="16" src="images/icons/trophy.png"> <a class="epic" href="?gos">Госзаказ</a><br>';
echo '<img width="16" height="16" src="images/icons/ruby.png" alt="o"> <a href="?payment">Рубины</a></li><li><img width="16" height="16" src="images/icons/forum.png" alt="o"> <a href="?forum">Форум</a></li><li><img width="16" height="16" src="images/icons/chat.png" alt="o"> <a href="?chat">Чат</a></li>';
echo "<li class='pt'><img width='16' height='16' src='images/icons/mails.png' alt='o'> <a href='?mail'>Почта</a>".(mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_mail` WHERE `id_user` = '$ku[id]' AND `read` = '0'"),0)!=0?" <span class='title'>(".mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_mail` WHERE `id_user` = '$ku[id]' AND `read` = '0'"),0).")</span>":null)."</li>";
echo '<li><img width="16" height="16" src="images/icons/favorite.png" alt="o"> <a href="?friends">Друзья</a></li>';
echo "<li>";
echo "".on_k($ku['id'])."";
echo ' <a href="?user='.$ku['id'].'">Профиль</a></li>';
if(isset($mc))
{
echo '<li><img alt="" width="16" height="16" src="images/icons/guild.png"> <a href="?mycollective">Колхоз</a></li>
<li><img width="16" height="16" src="images/icons/chat.png" alt="o"> <a href="?collective='.$mc['id'].'&selsovet">Сельсовет</a></li>';
}
echo '</ul></div></div>';

echo "<div class='block'><img width='16' height='16' src='images/icons/money.png' alt='o'> <span> $ku[money]</span> <img width='16' height='16' src='images/icons/ruby.png' alt='o'> <span>$ku[rubies]</span> <img width='16' height='16' src='images/icons/".(isset($dexp)?"doubleexp":"experience").".png' alt='o'> <span> ".($ku['level']<$bigl?"".rating($kr)."/".rating($level['rating'])."":"".rating($ku['rating'])."")." </span> опыта ";
echo "".on_k($ku['id'])."";
echo " <span>$ku[level]</span> уровень</div>";
echo "<div></div><div style='text-align:center;'><div class='pt'>Вы вошли как <a href='?user=$ku[id]'>$ku[nick]</a>, <a href='?outlogin=$ku[mdp]'>выйти</a>?</div><div><a href='?rules'>Правила игры</a> | <a href='?support'>Тех. поддержка</a>".($ku['dostup']==1?" | <a href='?admin'>Админка</a>":null)."</div></div>";
echo "<div></div><div style='text-align:center;'><div><span class='epic'>Удивительный Колхоз</span>";
echo "<div>".date('d.m.Y')."</div>";
echo "<div>".vremja($time)."</div>";
echo "</div>";

if(isset($mc))
{
include_once 'inc/next_level_collective.php';
include_once 'inc/station_act.php';
include_once 'inc/count_cash.php';
}
mysql_query("UPDATE `kolhoz_user` SET `flowerbed` = '12' WHERE `flowerbed` > '12'");
mysql_query("UPDATE `kolhoz_user` SET `cultivator` = '12' WHERE `cultivator` > '12'");
mysql_query("UPDATE `kolhoz_user` SET `irregate` = '12' WHERE `irregate` > '12'");
mysql_query("UPDATE `kolhoz_user` SET `soiler` = '12' WHERE `soiler` > '12'");
mysql_query("UPDATE `kolhoz_user` SET `conveyor` = '12' WHERE `conveyor` > '12'");
mysql_query("UPDATE `kolhoz_user` SET `seeder` = '12' WHERE `seeder` > '12'");
mysql_query("UPDATE `kolhoz_user` SET `fooder` = '12' WHERE `fooder` > '12'");
mysql_query("UPDATE `kolhoz_user` SET `fishfooder` = '12' WHERE `fishfooder` > '12'");
mysql_query("UPDATE `kolhoz_user` SET `autocrane` = '12' WHERE `autocrane` > '12'");
mysql_query("UPDATE `kolhoz_user` SET `incubator` = '12' WHERE `incubator` > '12'");
mysql_query("UPDATE `kolhoz_user` SET `harvester` = '12' WHERE `harvester` > '12'");
$count=$ku['flowerbed']+$ku['cultivator']+$ku['irregate']+$ku['soiler']+$ku['conveyor']+$ku['seeder']+$ku['fooder']+$ku['fishfooder']+$ku['autocrane']+$ku['incubator']+$ku['harvester'];
mysql_query("UPDATE `kolhoz_user` SET `tehnika` = '$count' WHERE `id` = '$ku[id]'");
if($ku['time_start']==0 || $ku['time_start']==NULL)mysql_query("UPDATE `kolhoz_user` SET `time_start` = '$time' WHERE `id` = '$ku[id]'");
mysql_query("UPDATE `kolhoz_user` SET `count_cp` = '0' WHERE `time_cp` < '$time'");
mysql_query("UPDATE `kolhoz_user` SET `money` = '".floor($ku['money'])."' WHERE `id` = '$ku[id]'");
mysql_query("UPDATE `kolhoz_user` SET `rating` = '".floor($ku['rating'])."' WHERE `id` = '$ku[id]'");
mysql_query("UPDATE `kolhoz_collective_user` SET `rubies` = '0' WHERE `rubies` = ''");
include_once 'inc/dostig2.php';
exit;
?>