<?
if($ku[guest]==1){echo "<div class='menu_razd2'><img src='/img/save_as.png' alt='*' /><a href='?login'> Сохранитесь!</a>  и получить <img width='16' height='16' src='images/icons/ruby.png' alt='o'> 100 тотемов!</div></div>";}
echo "</div>";
echo "<div class='framed'></div>";
echo "<div class='exp_bar_out'></div>";
echo "<div class='feedback'><img width='16' height='16' src='icons/green.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></div></div>";
echo "</div>";
echo "<div class='div_hr2'></div>";
if($ku['level']>=1)
{
$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;
echo "<div class='feedback'><img width='16' height='16' src='style/Panda (1).png' alt='o'> <a href='?mypetfarm'>Питомцы</a>  ".($count_zag?"<span class='title'>($count_zag)</span>":null)."</li>";
echo "</div>";
}
echo "<div class='div_hr2'></div>";
echo "<div class='feedback'><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_polka2` WHERE `id_user` = '$ku[id]' AND (`id_plant2` = '0' OR `cultivator2` = '0' OR `time` = '$time' OR `time` < '$time')"),0)!=0?"<span class='title'>(".mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_polka2` WHERE `id_user` = '$ku[id]' AND (`id_plant2` = '0' OR `time_water2` = '$time' OR `time` = '$time' OR `cultivator2` = '0' OR `time` = '$time' OR `time` < '$time')"),0).")</span>":null)."</li>";
echo "</div>";
echo "<div class='div_hr2'></div>";
echo "<div class='feedback'><li><img width='16' height='16' src='images/icons/water.png' alt='o'> <a href='?ozero'>Пруды</a> ".(mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_pond` 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_pond` 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></div>";
echo "</div>";
echo "<div class='div_hr2'></div>";
echo "<div class='feedback'><li><img width='16' height='16' src='images/icons/tree.png' alt='o'> <a href='?mytreefarm'>Садок</a> ".($count_zag?"<span class='title'>($count_zag)</span>":null)."</li>";
echo "</div>";
echo "<div class='div_hr2'></div>";
echo '<div class="feedback"><li><img width="16" height="16" src="icons/box.png" alt="o"> <a href="?warehouse">Склад</a></li></div>';
echo "</div>";
echo "<div class='div_hr2'></div>";
echo '<div class="feedback"><li><img width="16" height="16" src="icons/cart_remove.png" alt="o"> <a href="?market">Заготовки</a></li></div>';
echo "</div>";
echo "<div class='div_hr2'></div>";
echo '<div class="feedback"><li><img width="16" height="16" src="img/shop.png" alt="o"> <a href="?shop">Магазин</a></li></div>';
echo "</div>";
echo "<div class='div_hr2'></div>";
echo '<div class="feedback"><li><img width="16" height="16" src="icons/111.png" alt="o"> <a href="?center">Поселок</a></li></div>';
echo "</div>";
echo "<div class='framed'></div>";
echo "<div class='exp_bar_out'></div>";
echo "<div class='feedback'><img width='16' height='16' src='http://findicons.com/files/icons/2036/farm/48/eggs.png'> <a href='?tur'><b>Турнир</b></a><br>";
echo "</div>";
echo "<div class='div_hr2'></div>";
echo '<div class="feedback"><li><img alt="" width="16" height="16" src="icons/doubleexp.png"> <a href="?gos">Задания</a><br></div>';
echo "</div>";
echo "<div class='div_hr2'></div>";
echo '<div class="feedback"><li><img width="16" height="16" src="icons/page_forum_16_ns.png" alt="o"> <a href="?forum">Форум</a></li></div>';
echo "</div>";
echo "<div class='div_hr2'></div>";
echo '<div class="feedback"><li><img width="16" height="16" src="icons/comments.png" alt="o"> <a href="?chat">Чат</a>';
if($ku['chat_count']>0)echo "<span class='minor small'>(*)</span>";
echo "</li>";
echo "</div>";
echo "<div class='framed'></div>";
echo "<div class='exp_bar_out'></div>";
echo "<div class='feedback'><img width='16' height='16' src='icons/mail.png' alt='o'> <a href='?mail'>Почта</a></li></div>";
echo "</div>";
echo "<div class='div_hr2'></div>";
echo '<div class="feedback"><li><img width="16" height="16" src="icons/reseller_programm.png" alt="o"> <a href="?friends">Друзья</a></li></div>';
echo "</div>";
echo "<div class='div_hr2'></div>";
echo '<div class="feedback"><li><img alt="" width="16" height="16" src="icons/star.png"> <a href="?user='.$ku['id'].'">Профиль</a></li></div>';
if(isset($mc))
{
echo "<div class='div_hr2'></div>";
echo '<div class="feedback"><img alt="" width="16" height="16" src="images/icons/guild.png"> <a href="?mycollective">Племя</a></li></div>';
echo "</div>";
echo "<div class='div_hr2'></div>";
$count_selsovet = mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_collective_chat` WHERE `id_collective` = '$mc[id]'"),0);
echo "<div class='feedback'><img width='16' height='16' src='images/icons/chat.png' alt='o'> <a href='?collective=".$mc['id']."&selsovet'>Сельсовет</a> ($count_selsovet)</li></div>";
echo "</div>";
}
echo '</div></div></div>';

echo "<div class='framed'></div>";
echo "<div class='exp_bar_out'></div>";
echo "<div class='feedback1'><font color='yellow'><img width='16' height='16' src='images/icons/money.png' alt='o'> <span>$ku[money] <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> опыта</br>";
echo "".on_k($ku['id'])."";
echo " <span>$ku[level]</span> уровень</div></font>";
echo '</div></div>';
echo "<div class='content'>";
echo "<div class='block'><div>";
echo "<div class='noga'><div style='text-align:center;'>Вы вошли как <span class='epic'>$ku[nick]</span>, <a href='?out'><span class='epic'>выйти</span></font></a>?</div><br></div><div class='noga'><div class='small minor'><div><center><div><a href='?forum'>Помощь</font></a> | <a href='?forum=1'>Новости</font></a> |  <a href='?rating'>Рейтинг</font></a> | <a href='?online'>Онлайн</font></a> <span class='title'><span><span>".mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_user` WHERE `date_last` > '".(time()-900)."'"), 0)."</span></span></a> ".($ku['status']==3?" | <a href='?admin'>Админка</font></a>":null)."";
if($ku['status']>0)echo " | <a href='?zarplata'><font color='violet'>[Зарплата]</font></a></center>";
echo "</div></div></div></div>";
session_start();

ob_start();

$page_size = ob_get_length();

ob_end_flush();

if(!isset($_SESSION['traf'])){ $_SESSION['traf'] = 0; }

$_SESSION['traf'] += $page_size;
echo '<div style="text-align:center;" class="pt minor">Добавь в закладки: <a href="cadovod.tk" class="epic"><span class="epiс">cadovod.tk</span><br></a>';
echo "</a>© Все права защищены.<br>";
echo '<li class="pt"><marquee behavior="scroll" direction="up" height="15px" scrollamount="3"><center>
<a href="http://statok.ru/go/991"><img src="http://statok.ru/imageOther/991" alt=""/></a><br>
<script type="text/javascript" src="http://c.waptut.ru/6956/small.js"></script><noscript><a href="http://waptut.ru/in.go?id=6956"><img src="http://c.waptut.ru/6956/small.png" alt="Waptut.ru - Рейтинг мобильных сайтов" /></a></noscript></center></marquee></li>';
echo '</br>';

{
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 `coll` = '$mc[id]' WHERE `id` = '$ku[id]'");
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 `fooder` = '12' WHERE `fooder2` > '12'");
mysql_query("UPDATE `kolhoz_user` SET `harvester` = '12' WHERE `harvester` > '12'");
mysql_query("UPDATE `kolhoz_user` SET `conveyor2` = '12' WHERE `conveyor` > '12'");
mysql_query("UPDATE `kolhoz_user` SET `sponder` = '12' WHERE `sponder` > '12'");
mysql_query("UPDATE `kolhoz_user` SET `catchfish` = '12' WHERE `catchfish` > '12'");
mysql_query("UPDATE `kolhoz_user` SET `harvester2` = '12' WHERE `harvester2` > '12'");
mysql_query("UPDATE `kolhoz_user` SET `seeder2` = '12' WHERE `seeder2` > '12'");
mysql_query("UPDATE `kolhoz_user` SET `cultivator2` = '12' WHERE `cultivator2` > '12'");
mysql_query("UPDATE `kolhoz_user` SET `conveyor2` = '12' WHERE `conveyor2` > '12'");
$count=$ku['flowerbed']+$ku['cultivator']+$ku['cultivator2']+$ku['irregate']+$ku['soiler']+$ku['conveyor2']+$ku['conveyor']+$ku['catchfish']+$ku['sponder']+$ku['seeder']+$ku['seeder2']+$ku['fooder2']+$ku['fooder']+$ku['harvester2']+$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_collective_user` SET `rubies` = '0' WHERE `rubies` = ''");
include_once 'inc/dostig2.php';
echo "</div></div></div>";
exit;
?>