<?
if($ku['polosa']==0)
{
include_once 'inc/polosa.php';
}
else
{
echo "<div class='feedback'>";
echo "<div class='framed'>";
}

echo "<a href='?myfarm'><div class='list'><img width='16' height='16' src='images/icons/new/plants.png' alt='o'> ".(isset($_GET['myfarm'])?"<span>Грядки</span>":"Грядки</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)."</div></div></a>";
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;else $count_zag=$count_mon;
if($ku['level']>=10)
echo "<a href='?mypetfarm'><div class='list'><img width='16' height='16' src='images/icons/new/animal.png' alt='o'> ".(isset($_GET['mypetfarm'])?"<span>Загоны</span>":"<a href='?mypetfarm'>Загоны</a>")." ".($count_zag?"<span class='title'>($count_zag)</span>":null)."</div></a>";
}
if($ku['level']>=20)echo "<a href='?mygarden'><div class='list'><img width='16' height='16' src='images/icons/new/sad.png' alt='o'> ".(isset($_GET['mygarden'])?"<span>Сад</span>":"<a href='?mygarden'>Сад</a>")."  ".(mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_sad` WHERE `id_user` = '$ku[id]' AND (`id_tree` = '0' OR `time_sbor` = '$time' OR `time` = '$time' OR `time_sbor` < '$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_sad` WHERE `id_user` = '$ku[id]' AND (`id_tree` = '0' OR `time_sbor` = '$time' OR `time` = '$time' OR `time_sbor` < '$time' OR `time` < '$time' OR (`time_soil` = '$time' AND `soil` = '0') OR (`time_soil` < '$time' AND `soil` = '0'))"),0).")</span>":null)."</div></a>";
if($ku['level']>=10)echo "<a href='?mycellar'><div class='list'><img width='16' height='16' src='images/icons/new/recipes.png' alt='o'> ".(isset($_GET['mycellar'])?"<span>Погреб</span>":"Погреб</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)."</div></a>";
if($ku['level']>=15)echo "<a href='?ozero'><div class='list'><img width='16' height='16' src='images/icons/new/fish.png' alt='o'> ".(isset($_GET['ozero'])?"<span>Пруды</span>":"Пруды</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)."</div></a>";
echo "<a href='?mywork'><div class='list'><img width='16' height='16' src='images/icons/new/supplier.png' alt='o'> ".(isset($_GET['shop'])?"<span>Робота</span>":"Работа</a>")." </div></a>";
echo "</div>";
echo "<div class='feedback'>";
echo "<a href='?shop'><div class='list'><img width='16' height='16' src='images/icons/new/cart.png' alt='o'> ".(isset($_GET['shop'])?"<span>Магазин</span>":"Магазин</a>")." </div></a>";
echo "<a href='?center'><div class='list'><img width='16' height='16' src='images/icons/new/center.png' alt='o'> ".(isset($_GET['center'])?"<span>Город</span>":"Город</a>")." </div></a>";
echo "<a href='?warehouse'><div class='list'><img width='16' height='16' src='images/icons/new/warehouse.png' alt='o'> Амбар</div></a>";

$visitt=mysql_fetch_array(mysql_query("SELECT * FROM kolhoz_config WHERE id='1'"));
$visittur_iden=0;
$visittur_array=explode(',',$visitt['visittur']);
$visittur_nu=count($visittur_array);
$visittur_num=$visittur_nu+1;
$itur=0;
while(true)
{
if($itur==$visittur_num){break;}
if($visittur_array[$itur]==$ku['id']){$visittur_iden=1; break;}
$itur++;
}

echo '<a href="?tournament"><div class="list"><img width="16" height="16" src="/images/turnir.png" alt="o"> Турнир</a>'.($visittur_iden!=1?' <span class="minor small">(*)</span>':null).'</div></a>';
echo "</div><div class='feedback'>";

echo "<li class='pt'><a href='?action'><div class='list'><img width='16' height='16' alt='' src='images/icons/new/action.png'> ".(isset($_GET['action'])?"<span>Акция</span>":"Акция</a>")."  <img width='16' height='16' src='/images/icons/ruby.png' alt='o'> <span class='title'>+150%</span></div></a>";

echo "<a href='?quest'><div class='list'><img alt='' width='16' height='16' src='images/quest.png'> ".(isset($_GET['quest'])?"<span>Задания</span>":"<a href='?quest'>Задания")."</div></a>";

echo "<a href='?gos'><div class='list'><img alt='' width='16' height='16' src='images/icons/new/trophy.png'> ".(isset($_GET['gos'])?"<span>Госзаказ</span>":"Госзаказ")."</div></a>";
echo "<a href='?payment'><div class='list'><img width='16' height='16' src='images/icons/new/ruby.png' alt='o'> ".(isset($_GET['payment'])?"<span>Рубины</span>":"Рубины")."</div></a>";
$count_chat=mysql_result (mysql_query("SELECT COUNT(*) FROM `kolhoz_chat` "),0);
$count_forum=mysql_result (mysql_query("SELECT COUNT(*) FROM `kolhoz_forum` "),0);

$visitfor_iden=0;
$visitfor_array=explode(',',$visitt['visitforum']);
$visitfor_nu=count($visitfor_array);
$visitfor_num=$visitfor_nu+1;
$ifor=0;
while(true)
{
if($ifor==$visitfor_num){break;}
if($visitfor_array[$ifor]==$ku['id']){$visitfor_iden=1; break;}
$ifor++;
} echo "<a href='?forum'><div class='list'><img width='16' height='16' src='images/icons/new/forum.png' alt='o'> ".(isset($_GET['forum'])?"<span>Форум</span>":"Форум")."";

echo ''.($visitfor_iden!=1?' <span class="minor">(*)</span>':null).'</div></a>';

echo "<a href='?chat'><div class='list'><img width='16' height='16' src='images/icons/new/chat.png' alt='o'> ".(isset($_GET['chat'])?"<span>Чат</span>":"Чат")."";
if($ku['chat_count']>0)echo "<span class='minor small'> (*)</span>";
if($ku['chat_count1']>0 && $ku['status']>0 )echo "<span class='minor small'> (**)</span>[1<img src='images/icons/chat.png'>=3<img src='images/icons/ruby.png'>]<a></div>";
echo "</a></div></div><div class='feedback'>";


echo "<li class='pt'><a href='?mail'><div class='list'><img width='16' height='16' src='images/icons/new/mails.png' alt='o'> ".(isset($_GET['mail'])?"<span>Почта</span>":"<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)."</div></a>";
echo "<a href='?friends'><div class='list'><img width='16' height='16' src='images/icons/new/favorite.png' alt='o'> ".(isset($_GET['friends'])?"<span>Друзья</span>":"Друзья")."</div></a>";
echo '<a href="?user='.$ku['id'].'"><div class="list"><img width="16" height="16" src="images/icons/new/profile.png" alt="o"> Профиль</div></a>';
if(isset($mc))
{
echo '<a href="?mycollective"><div class="list"><img alt="" width="16" height="16" src="images/icons/new/guild.png">Колхоз</div></a>';
if($ku['ktime']<time() && $ku['ruba']==1)echo" <span class='minor'>(*)</span>";
echo '<a href="?collective='.$mc['id'].'&selsovet"><div class="list"<img width="16" height="16" src="images/icons/new/chat.png" alt="o">Сельсовет</div></a>';
echo "</div><div class='feedback'>";
}
echo '</ul>';
echo "<div class='framed'>";
echo '</ul>';
echo "<div class='blocked event'><small><img width='16' height='16' src='images/icons/money.png' alt='Монеты' title='Монеты'> <span>".rating($ku['money'])." <img width='16' height='16' src='images/icons/ruby.png' alt='Рубины' title='Рубины'> <span>".rating($ku['rubies'])."</span>".($ku['tuenir_on']==1?" <span> <img width='20' height='20' src='images/turnir.png' title='Золото'>".rating($ku['turnir'])."</span> ":null)." <img width='16' height='16' src='images/icons/".(isset($dexp)?"doubleexp":"experience").".png' alt='o' title='Опыт'> <span> ".($ku['level']<$bigl?"".rating($kr)."/".rating($level['rating'])."":"".rating($ku['rating'])."")." </span> ";echo "".on_k($ku['id'])."";
echo " <span>$ku[level]</span> уровень</small></div></span>";
echo "</div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div>";
echo '</ul></div><div/>';
echo "<li class='pt'><div class='feedback'><center>Вы вошли как <a href='?user=$ku[id]'>$ku[nick]</a>,<img width='16' height='16' src='images/icons/cross.png' alt='o'><a href='?out'>выйти</a>?</div></center></li>";
echo "<li class='pt'><div class='small'><div class='feedback'><center><a href='?rules'>Правила игры</a> | <a href='?support'>Тех. Поддержка</a>  ".($ku['status']==1 || $ku['status']==3?" | <a class='epic blok' href='?tikets'>Тикеты".(mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_tikets` WHERE `read` = '0'"),0)!=0?" (+".mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_tikets` WHERE `read` = '0'"),0).")":null)."</a>":null)." </center></li>";
echo "<div class='small'><center>".($ku['dostup']==1?"<a href='?admin'>Админка</a> | <a href='http://ukollhoz.tk/color.html'>Цвета</a>":null)."";
echo "<div class='small'><center>";

echo '</ul></div></div>';
echo "</div></div></div></div></div>";
echo "</div>";
echo "<div></div><div style='text-align:center;' class='pt small minor'>Добавь в закладки: <a href='http://ukollhoz.tk' class='epic'><span>ukollhoz.tk</span></a> ";
echo "<div>&copy; 2012 Онлайн-игра <span>Современный Колхоз</span></br></div>";
echo "<div></div><div style='text-align:center;'>Рассказать о нас:<div></span>";
echo "<script type='text/javascript' src='//yandex.st/share/share.js'charset='utf-8'></script><div class='yashare-auto-init' data-yashareL10n='ru' data-yashareType='none' data-yashareQuickServices='yaru,vkontakte,facebook,twitter,odnoklassniki,moimir'></div>";
$date = date("d $m"); 
$today[1] = date("H:i:s");
echo(" $date $today[1]");





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 `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 `catchfish` = '12' WHERE `catchfish` > '12'");
mysql_query("UPDATE `kolhoz_user` SET `catchfish` = '12' WHERE `sponder` > '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['catchfish']+$ku['cultivator2']+$ku['harvester2']+$ku['seeder2']+$ku['sponder']+$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'");
include_once 'inc/dostig2.php';
exit;
?>