<?



$max = $level['rating'];
$tek = $kr;
$forl = ($tek/$max)*100;
echo'<div style="border:1px solid #55A855; border-radius:7px;margin-top:1px;"><div class="expline" style="width:'.$forl.'%;"></div>';
echo '</div>';
echo "<ul class='block'>";


echo "<li>";
echo "<img width='16' height='16' src='/img/icons/new/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='/img/icons/new/zagon.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='/img/icons/new/recipes.png' alt='o'> <a href='?mycellar'>Погреб</a> ".(mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_polka` WHERE `id_user` = '$ku[id]' AND (`id_recipes` = '0' OR `clean` = '0' OR `time` = '$time' OR `time` < '$time')"),0)!=0?"<span class='title'>(".mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_polka` WHERE `id_user` = '$ku[id]' AND (`id_recipes` = '0' OR `time_water` = '$time' OR `time` = '$time' OR `clean` = '0' OR `time` = '$time' OR `time` < '$time')"),0).")</span>":null)."</li>";
if($ku['level']>=40)echo '<li><img width="16" height="16" src="/img/icons/new/pool.png" alt="o"> <a href="?myprud">Пруды</a></li>';
echo '<li><img width="16" height="16" src="/img/icons/new/warehouse.png" alt="o"> <a href="?warehouse">Амбар</a></li>';
echo '<li><img width="16" height="16" src="/img/icons/new/cart.png" alt="o"> <a href="?shop">Магазин</a></li>';
echo '<li><img width="16" height="16" src="/img/icons/new/center.png" alt="o"> <a href="?center">Город</a></li>';
echo '<li class="pt"><img alt="" width="16" height="16" src="/img/icons/new/ruby.png"> <a class="epic" href="?action">Акция</a><br>';
echo '<img alt="" width="16" height="16" src="/img/icons/new/trophy.png"> <a href="?gos">Госзаказ</a><br>';


echo '<img width="16" height="16" src="/img/icons/new/ruby.png" alt="o"> <a href="?payment">Рубины</a></li><li><img width="16" height="16" src="/img/icons/new/forum.png" alt="o"> <a href="?forum">Форум</a></li><li><img width="16" height="16" src="/img/icons/new/chat.png" alt="o"> <a href="?chat">Чат</a></li>';
echo "<li class='pt'><img width='16' height='16' src='/img/icons/new/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="/img/icons/new/favorite.png" alt="o"> <a href="?friends">Друзья</a></li>';
echo "<li>";
echo '<img alt="" width="16" height="16" src="/img/icons/new/profile.png"> <a href="?user='.$ku['id'].'">Профиль</a></li>';
if($mc['id']>0)
{
echo '<li><img alt="" width="16" height="16" src="/img/icons/new/guild.png"> <a href="?mycollective">Колхоз</a></li>
<li><img width="16" height="16" src="/img/icons/new/chat.png" alt="o"> <a href="?collective='.$mc['id'].'&selsovet">Сельсовет</a></li>';
}
echo '</ul>';
echo'<div class="framed">
<div class="block small"><span class="title">';
echo "<img width='16' height='16' src='/img/icons/money.png' alt='o'> <span> $ku[money]</span> <img width='16' height='16' src='/img/icons/ruby.png' alt='o'> <span>$ku[rubies]</span> <img width='16' height='16' src='/img/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></div></div>";
$result = mysql_query("SELECT * FROM `lottery` WHERE `time` > '$time' ORDER BY `time` DESC LIMIT 10000000000");
while($msg = mysql_fetch_assoc($result)){
    echo "<div class='block'>";
  echo 'Игрок <span class="title">'.nc($msg['id_user']).'</span> выиграл ДжекПот <span class="title"><img width="16" height="16" src="/img/icons/ruby.png">'.($msg['JackPot']).'</span> рубинов!<br></div>';

}
define("mdp", 1);

echo "</div></div><br><div style='text-align:center;'>Вы вошли как $ku[nick], "; echo '<a href="?outlogin='.$ku['mdp'].'">выйти</a>';echo "?</br><a href='?settings'>Настройки</a> | <a href='?support'>Тех. Поддержка</a> | <a href='?rules'>Соглашение</a> ".($ku['dostup']==1?"| <a href='?admin'>Админка</a>":null)."".($ku['status']>0?"| <a href='?ModerationPhoto'>Модерация фото</a> ".(mysql_result(mysql_query("SELECT COUNT(*) FROM `user_avatar` WHERE `check` = '0'"),0)!=0?" (+".mysql_result(mysql_query("SELECT COUNT(*) FROM `user_avatar` WHERE `check` = '0'"),0).")":null)."</a>":null)."".($ku['dostup']==1?"| <a href='?admin=payment'>Покупка рубинов</a> ".(mysql_result(mysql_query("SELECT COUNT(*) FROM `admin_payment` WHERE `check` = '0'"),0)!=0?" (+".mysql_result(mysql_query("SELECT COUNT(*) FROM `admin_payment` WHERE `check` = '0'"),0).")":null)."</a>":null)."  ".($ku['dostup']==1?"| <a href='?AdminMail'>Рассылка</a>":null)."<br>";
echo '</div>';
echo "</div>";
echo'<div style="text-align:center;" class="pt small minor">';
echo "Онлайн игра <span class='epic'>Удивительный колхоз</span><div> </span>";
echo "<div>".date('d.m.Y')."</div>";
echo "<div>".vremja($time)."</div>";
echo "<div></div><div style='text-align:center;'>Powered by <span class='epic'>Pavel Grey</span><div></span>";

echo "<div></div><div style='text-align:center;'>Версия: <span class='epic'>2.0.0</span><div></span>";
echo "</div>";

if(isset($mc))
{
  include_once 'inc/collective/next_level_collective.php';
  include_once 'inc/collective/station_act.php';
  include_once 'inc/collective/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'");
mysql_query("UPDATE `kolhoz_user` SET `iseeder` = '12' WHERE `iseeder` > '12'");
mysql_query("UPDATE `kolhoz_user` SET `plug` = '12' WHERE `plug` > '12'");
$count=$ku['flowerbed']+$ku['cultivator']+$ku['irregate']+$ku['soiler']+$ku['conveyor']+$ku['seeder']+$ku['fooder']+$ku['fishfooder']+$ku['autocrane']+$ku['incubator']+$ku['iseeder']+$ku['plug']+$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/user/dostig2.php';
exit;
?>