<?
echo'</div></span></div>
';
//$text='[color=yellow][b][url=/online/admin]Администрация игры поздравляет всех с 14 февраля![/url][/b][/color]';
//echo '</div><div class="block txt-md"> <marquee direction="left"><font color="yellow">'.output_text($text).'</font></span></marquee></div>';

if(isset($ku['id'])){
if($ku['theme']==2){$style="404040";}
if(empty($ku['theme']) or $ku['theme']==1){$style="114411";}
echo "<div class='content'><ul class='block'>";
if($ku['exp5_time']>$time)echo'<center><img width="11" src="pavelgrey/img/exp5.png"> <span class="txt-md title"> опыт на '.time_left($ku['exp5_time']-$time).'</center>';
echo "<li class='ptm'></li></li><li>";
echo "<img width='16' height='16' src='images/icons/plants.png' alt='*'> <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='*'> <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']>=40)echo "<li><img width='16' height='16' src='images/icons/pool.png' alt='*'> <a href='/mypool'>Пруды</a> ".(mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_pool` WHERE `id_user` = '$ku[id]' AND (`id_fish` = '0' OR `time` = '$time' OR `time` < '$time' OR `time_soil` = '$time' OR `time_soil` < '$time')"),0)!=0?"<span class='title'>(".mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_pool` WHERE `id_user` = '$ku[id]' AND (`id_fish` = '0' OR `time` = '$time' OR `time` < '$time' OR `time_soil` = '$time' OR `time_soil` < '$time')"),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='*'> <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='*'> <a href='/nk'>Погреб</a></li>";
echo '<img src="images/ovca.jpg" width="16" height="16"> <a href="?sheep">Баранчик</a> <font color=red> </font></br></a>';
echo"<li><img width='16' height='16' src='/images/icons/dig.png' alt='*'> <a href='/mywork'>Работа</a></li>";

if($ku['keytime']>=$time)echo "<li><img width='16' height='16' src='images/icons/last_recipes.png' alt='*'> <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>";
}

////////////////////////////////////////////////////////////Сады
if($ku['level']>=45)
{
$count_mon=mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_garden` WHERE `id_user` = '$ku[id]' AND `id_pet` != '0' AND (`time_money` = '$time' OR `time_money` < '$time')"),0);
$q=mysql_query("SELECT * FROM `kolhoz_garden` 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_garden` 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/sad.png' alt='*'> <a href='/mygarden'>Сады</a> ".($count_zag?"<span class='title'>($count_zag)</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 class="pt"><img alt="" width="16" height="16" src="/images/icons/ruby.png">  <a href="/action">Акция</a> <img alt="" width="16" height="16" src="/images/fermoney.png"> <span class="title txt-md">+400%</span>';
echo '<br><img width="16" height="16" src="images/icons/trophy.png"> <a href="/gos">Госзаказ</a>'.(isset($mc) && $conf['gos_look']==0?'<img width="16" height="16" alt="*" src="/images/icons/nocollective.png"/>':null).'';
echo '<br><img width="16" height="16" src="images/icons/ruby.png" alt="*"> <a href="/?payment"> Банк </a></li>';


echo'<br><li><img width="16" height="16" src="images/icons/center.png" alt="o"> <a href="/center">Город</a></li>';
echo '<li><img width="16" height="16" src="images/icons/forum.png" alt=""> <a href="/forum">Форум</a></li>';
echo '<li><img width="16"  src="/rice/images/driver.png" alt=""> <a href="/?rice">Гонки</a></li>';
echo '<li><img width="16" height="16" src="/images/icons/chat.png" alt="*"> '.(isset($_GET["chat"])?'<span>Чат</span>':'<a href="/chat-4837">Чат</a>').''.(mysql_result(mysql_query("SELECT COUNT(*) FROM `chat_see` WHERE `id_chat` = '0' AND `id_user` = '$ku[id]'"), 0)==0 && $conf['privat_count']<1?" <span class='minor'>(*)</span>":null).'</li>';

echo "<li class='pt'><img width='16' height='16' src='images/icons/mails.png' alt=''> <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 "".(($ku['status']==1 || $ku['status']==3) && mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_ticket` WHERE (`id_adm` = '0' || (`id_adm` = '$ku[id]' && `otvet`='1')) && `otdel`='".($ku['status']==1?"1":"2")."'"),0)!=0?"<li><img width='16' height='16' src='/images/icons/tickets.png' alt=''> <a href='/support'>Заявки</a>  <span class='title'>(".mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_ticket` WHERE (`id_adm` = '0' || (`id_adm` = '$ku[id]' && `otvet`='1')) && `otdel`='".($ku['status']==1?"1":"2")."'"),0).")</span>":null)."";
echo '<li><img width="16" height="16" src="images/icons/favorite.png" alt=""> <a href="/friends">Друзья</a></li>';
echo "<li>";
echo "".on_k($ku['id'])."";
echo ' <a href="/user/'.$ku['id'].'">Профиль</a></li>';

if($ku['wall']==1)$of='(*)';
echo "<li><img width='16' height='16' src='images/icons/favorite.png' alt=''> <a href='/?wall=$ku[id]'>Моя стена</a> $of</li>";

if(isset($mc))
{
echo '<li><img alt="" width="16" height="16" src="images/icons/guild.png"> <a href="/collective-'.$mc['id'].'">Колхоз</a></li>
<li><img width="16" height="16" src="images/icons/chat.png" alt="o"> <a href="/selsovet/collective-'.$mc['id'].'">Сельсовет</a></li>';
}
///echo'</div><div class="block"><center> <img title="Паук" style="border-radius: 4px;" width="25" src="/pavelgrey/megabattle/pauk.jpg"> <a href="/?megabattle">Пауки против Скорпионов</a> <img title="Скорпион" style="border-radius: 4px;" width="25" src="/pavelgrey/megabattle/scorpion.jpg"> </center> ';

////echo'</div><div class="block"><center> <img width="20" src="https://cdn3.iconfinder.com/data/icons/fatcow/32/flag_red.png"> <a href="/?rollcall">Ивент "Перекличка"</a> </center> ';

echo'</div><div class="block"><center> <img width="20" src="/pavelgrey/img/badge/red_star.png"> <a href="/?tournoument">Ивент "Турнирная таблица"</a> </center> ';

$geroi=mysql_fetch_array(mysql_query("SELECT * FROM `kolhoz_user` WHERE `geroi` = '1'"));
echo'</div><div class="block"><center><img src="https://cdn0.iconfinder.com/data/icons/kameleon-free-pack-rounded/110/Medal-2-20.png"> Герой дня: '.on_k($geroi['id']).' '.nc($geroi['id']).' <a href="/?forum=56"></a></center> </div>';
echo '</ul></div></div>';
  echo "<div class='framed'><span class='title'>
<div class='block small'><img width='16' height='16' src='images/fermoney.png' alt='*'> <span>".(strkol($ku['fermoney']))."</span> <img width='16' height='16' src='images/icons/money.png' alt='*'> <span>".(strkol($ku['money']))."</span> <img width='16' height='16' src='images/icons/ruby.png' alt='*'> <span>".(strkol($ku['rubies']))."</span> <img width='16' height='16' src='images/icons/".(isset($dexp) && !isset($dexp3)?"doubleexp":"".(isset($dexp3)?"threexp":"experience")."").".png' alt='*'> <span> ".($ku['level']<$bigl?"".rating($kr)." / ".rating($level['rating'])."":"".rating($ku['rating'])."")."</span> опыта ";
echo "".on_k($ku['id'])."";
echo " <span>$ku[level]</span> уровень</div></span>";
echo'</div></div></div></div></div></div></div></div></div></div>';
echo "<div style='text-align:center;'><div class='ptm'>";
echo "Вы вошли как <span class='text'>$ku[nick]</span>, <a href='?outlogin=$ku[mdp]'>выйти</a>?";
echo"</div><div class='pt minor'><li class='pavelgrey'><a href='/?forum=369'>Помощь</a> | <a href='/?PersonalArea'>Личный кабинет</a> | <a href='/agreement'>Cоглашение</a><br><a href='/?support'>Тех.поддержка</a><li class='pavelgrey'>".($ku['status']==3?" <a href='/admin'>Админка</a> | <a href='/mailr'>Рассылка</a> <center><a class='epic blok' href='?complaints'>Жалобы <span class='title'>(".mysql_result(mysql_query("SELECT COUNT(*) FROM `complaint` WHERE `check` = '1'"),0)."/<font color='red'>+".mysql_result(mysql_query("SELECT COUNT(*) FROM `complaint` WHERE `check` = '0'"),0)."</font>)</span></a>":null)." ".($ku['status']==1 || $ku['status']==3?"| <a href='/?TicketInfo&Support'>Тикеты</a> ".(mysql_result(mysql_query("SELECT COUNT(*) FROM `me_tikets` WHERE `read` < '1'"),0)!=0?" (".mysql_result(mysql_query("SELECT COUNT(*) FROM `me_tikets` WHERE `read` < '1'"),0).")":null)."":null)." 
" ;

echo'<div style="text-align:center;" class="pt small minor">
Добавь в закладки
<a href="http://tilas.ru" class="minor"><span>tilas.ru</span></a><br/>

&copy; 2015 Онлайн-игра <span>Моя Деревня</span><br/>
<div><li class="pavelgrey">';
echo'<a href="http://vk.com/clubtilas"><img width="98" src="/images/vk.png"></a> <a href="http://m.ok.ru/dk?st.cmd=altGroupMain&st.groupId=52346158842000&_prevCmd=userAltGroups&tkn=2843&_aid=groupOwnShowcase"><img width="98" src="/images/ok.png"></a><br>';
$date = date("d.0n.y"); 
$today[1] = date("H:i:s");
echo'<li class="pavelgrey"><span class="minor">'.$date.' г. '.$today[1].'</span><li class="pavelgrey">';
echo "<div></div><div style='text-align:center;'><div></span>";

echo "</div>";

if($ku['arena_rating']>$ku['level']*100)mysql_query("UPDATE `kolhoz_user` SET `arena_rating` = '".floor($ku['level']*100)."' WHERE `id` = '$ku[id]' LIMIT 1");
$count=$ku['flowerbed']+$ku['cultivator']+$ku['irregate']+$ku['soiler']+$ku['conveyor']+$ku['seeder']+$ku['fooder']+$ku['harvester']+$ku['harvester2']+$ku['cultivator2']+$ku['seeder2']+$ku['avtoconveyor']+$ku['avtofooder']+$ku['fishfooder']+$ku['autocrane']+$ku['incubator'];
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 `count_pp` = '0' WHERE `time_pp` < '$time' and `id`='$ku[id]' LIMIT 1");
$ku=mysql_fetch_array(mysql_query("SELECT * FROM `kolhoz_user` WHERE `id` = '$ku[id]'"));
mysql_query("UPDATE `kolhoz_user` SET `money` = '".round($ku['money'])."',`rating` = '".round($ku['rating'])."',`rubies` = '".round($ku['rubies'])."', `date_last` = '".time()."' WHERE `id` = '$ku[id]' LIMIT 1");

if(isset($_GET['mycollective']))include_once 'inc/next_level_collective.php';
include_once 'inc/dostig2.php';

$a=number_format(microtime(1)-$t,3);
$y = explode('.', $a);
echo '<div style="color:#555555;"><span> '.intval($y[1]).' ms. ('.$time.')</span></div>';
}else{





if($_SERVER['HTTP_HOST']!=='vk.vferme.com'){echo "<div></div>

<div style='text-align:center;' class='pt small minor'>Добавь в закладки ";

echo "<a href='http://$_SERVER[HTTP_HOST]' class='epic'><span>$_SERVER[HTTP_HOST]</span></a><br/>";}else{echo"<div style='text-align:center;' class='ptm'>";} 





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


echo'</body></html>';
unset($ku,$conf);
exit;
ob_end_flush();
?>