<?

if(isset($ku['id'])){
if($ku['theme']==2){$style="404040";}
if(empty($ku['theme']) or $ku['theme']==1){$style="114411";}

if(empty($level['rating']))$level['rating']=1;
$exp=round($kr/($level['rating']/100));
echo'</div><div style="margin:0px;background-color:#'.$style.'"> 
<div class="expline" style="width:'.$exp.'%;"></div></div>';
echo "<div class='content'><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>";

echo "<img width='16' height='16' src='images/fish/fish.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>";

if($ku['level']>=10)
{
$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+$count_gol;else $count_zag=$count_mon+$count_gol;
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']>=20){
if($ku['keytime']<$time)echo "<li><img width='16' height='16' src='images/icons/zkey.png' alt='o'> <a href='nk'>Погреб</a></li>";
if($ku['keytime']>=$time)echo "<li><img width='16' height='16' src='images/icons/last_recipes.png' alt='o'> <a href='
mycellar'>Пoгpeб</a> ".(mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_polka2` WHERE `id_user` = '$ku[id]'
AND (`id_plant2` = '0' 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` < '$time' )"),0).")</span>":null)."</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/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 small event'><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 style='text-align:center;'><div class='ptm'>";
//Вы вошли как <span>$ku[nick]</span>, <a href='?outlogin=$ku[mdp]'>выйти</a>?
echo"</div><small><a href='?rules'>Правила игры</a> | <a href='?support'>Тех. поддержка</a>".($ku['id']==1?" | <a href='?admin'>Админка</a>":null)."";
echo "<br/>Онлайн-игра <span class='epic'>Супер Ферма</span><br/>";
echo'<script type="text/javascript" src="http://mobtop.ru/c/47508.js"></script><noscript><a href="http://mobtop.ru/in/47508"><img src="http://mobtop.ru/47508.gif" alt="MobTop"/></a></noscript>';
echo'<a href="http://waplog.net/c.shtml?29767"><img src="http://c.waplog.net/29767.cnt" alt="waplog"></a> ';
//echo'<a href="http://wap.top.wapstart.ru/?s=22311"><img src="http://counter.wapstart.ru/index.php?c=27127;b=1;r=0;s=27127" alt="wapstart"  /></a>';
                                  
$a=number_format(microtime(1)-$t,3);
$y = explode('.', $a);
echo '<br/><div style="color:#555555;"><span> '.intval($y[1]).' ms.</span></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 `harvester` = '12' WHERE `harvester` > '12'");*/
$count=$ku['sponder']+$ku['catchfish']+$ku['flowerbed']+$ku['cultivator']+$ku['irregate']+$ku['soiler']+$ku['conveyor']+$ku['seeder']+$ku['fooder']+$ku['harvester']+$ku['harvester2']+$ku['cultivator2']+$ku['seeder2'];
if($count!==$ku['tehnika'])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_fp` = '0' WHERE `time_fp` < '$time' and `id`='$ku[id]' LIMIT 1");
mysql_query("UPDATE `kolhoz_user` SET `count_cp` = '0' WHERE `time_cp` < '$time' and `id`='$ku[id]' LIMIT 1");
//mysql_query("UPDATE `kolhoz_user` SET `money` = '".floor($ku['money'])."' WHERE `id` = '$ku[id]' LIMIT 1");
//mysql_query("UPDATE `kolhoz_user` SET `rating` = '".floor($ku['rating'])."' WHERE `id` = '$ku[id] LIMIT 1'");
//mysql_query("UPDATE `kolhoz_collective_user` SET `rubies` = '0' WHERE `rubies` = ''");
include_once 'inc/dostig2.php';
}else{
echo "</div><div class='block event'>";
$online=mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_user` WHERE `date_last` > '".(time()-600)."'"), 0);
if($online==0){$online=1;}
echo "Онлайн <span class='title'>$online</span>, регистраций
<span class='title'>".mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_user`"), 0)."</span></div>";
echo "</div>";
echo "<div></div><div style='text-align:center;' class='ptm'>Добавь в закладки ";
echo "<a href='http://$_SERVER[HTTP_HOST]' class='epic'><span>$_SERVER[HTTP_HOST]</span></a><br>";
echo'<script type="text/javascript" src="http://mobtop.ru/c/47507.js"></script><noscript><a href="http://mobtop.ru/in/47507"><img src="http://mobtop.ru/47507.gif" alt="MobTop"/></a></noscript>';
echo'<a href="http://waplog.net/c.shtml?29766"><img src="http://c.waplog.net/29766.cnt" alt="waplog"></a> <br/>';
echo'<a href="http://weplog.net/in/10800"><img src="http://weplog.net/10800/1.cnt" alt="weplog"/></a>';
echo'<a href="http://sowap.ru/?uid=530"><img src="http://sowap.ru/countmini.php?uid=530" alt="sowap.ru" /></a>';
echo'<a href="http://topwap.us/click.php?3044"><img src="http://topwap.us/image.php?3044,small" alt="topwap.us" /></a>';
echo'<br/><a href="http://wap.top.wapstart.ru/?s=22311"><img src="http://counter.wapstart.ru/index.php?c=27127;b=1;r=0;s=27127" alt="wapstart"  /></a>';
echo'<img src="http://wbn.su/1114.gif" alt="wbn" />';
/*///////////Проверка браузер, реклама
$brauser=htmlspecialchars(stripslashes($_SERVER['HTTP_USER_AGENT']));
$h_ua = str_replace('windows ce', '', strtolower($brauser));
if (
    !$h_ua ||
    strpos($h_ua, 'windows') !== false    ||
    strpos($h_ua, 'linux') !== false    ||
    strpos($h_ua, 'bsd') !== false        ||
    strpos($h_ua, 'x11') !== false        ||
    strpos($h_ua, 'unix') !== false        ||
    strpos($h_ua, 'macintosh') !== false    ||
    strpos($h_ua, 'macos') !== false)
{}elseif(preg_match('|opera|i', strtolower($brauser))){}else{
echo'<script type="text/javascript" src="http://wbn.su/929.js"></script><noscript><p><a href="http://wbn.su/929.lnk"><img src="http://wbn.su/929.img" alt="wbn"/></a></p></noscript>';
}

//////////*/
$a=number_format(microtime(1)-$t,3);
$y = explode('.', $a);
echo '<br/><div style="color:#555555;"><span> '.intval($y[1]).' ms.</span></div>';
echo "</div>";}
echo'</body></html>';
exit;
ob_end_flush();
?>