Файл: ferma/inc/farm.php
Строк: 241
<?
if(isset($_GET['gos']))
{
if(isset($mc))
{
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_plant` WHERE `id` = '$gos[id_plant]' AND (`level` = '$ku[level]' OR `level` < '$ku[level]')"),0)!=0)
mysql_query("UPDATE `kolhoz_user` SET `last_plant` = '$gos[id_plant]' WHERE `id` = '$ku[id]'");
header("Location:?farm");
exit;
}
else err_game("Для начала вступите в колхоз.");
}
include_once 'inc/change_plant.php';
include_once 'inc/change_soil.php';
include_once 'inc/cultivator_all.php';
include_once 'inc/cultivator.php';
include_once 'inc/harvest_all.php';
include_once 'inc/harvest.php';
include_once 'inc/seat_all.php';
include_once 'inc/seat.php';
include_once 'inc/soil_all.php';
include_once 'inc/soil.php';
include_once 'inc/water_all.php';
include_once 'inc/water.php';
include_once 'inc/clean_grounds.php';
include_once 'inc/new_ground.php';
include_once 'inc/next_level.php';
echo "<div class='g1'>Моя ферма</div>";
if(isset($_SESSION['cp']))
{
echo "<div class='feedback'><ul class='feedbackPanel'><li class='feedbackPanelINFO'><span class='feedbackPanelINFO'>Бесплатная очистка грядок будет доступна через ".time_left($ku['time_cp']-$time)."</span></li></ul></div>";
unset($_SESSION['cp']);
}
echo "<hr>";
echo on_k($ku['id']);
echo " <font size='2.5'><a class='' href='?user=$ku[id]'><span>".nc($ku['id'])."</span></a></span>";
echo "<font color='black'> » </font><a href='?farm'>Моя ферма</a></font>";
echo "<hr>";
////ГРЯДКИ
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_ground` WHERE `id_user` = '$ku[id]'"),0);
if ($k_post==0)
{
echo "Участков нету приобретите";
}
$k_page=k_page($k_post,3);
$page=page($k_page);
$start=3*$page-3;
$q=mysql_query("SELECT * FROM `kolhoz_ground` WHERE `id_user` = '$ku[id]' ORDER BY `id` DESC LIMIT $start, 3");
while($post=mysql_fetch_array($q))
{
echo "<li>";
if($post['id_plant']!=0 && mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_plant` WHERE `id` = '$post[id_plant]'"),0)!=0)$plant=mysql_fetch_array(mysql_query("SELECT * FROM `kolhoz_plant` WHERE `id` = '$post[id_plant]'"));
if($ku['sk']==0)echo "<li><g5><img width='60' height='80' src='".(!isset($plant)?"".($post['cultivator']==1?"i/grad.png":"i/dirt2_new.png")."":"i/plants/$plant[id].png")."' alt='o' class='portrait'></g5>";
echo "<div>";
echo "".(!isset($plant)?"<span class='kra'>".($post['cultivator']==1?"Земля, готовая к посеву<li>Посадите что нибудь</li>":"Необработанная земля")."</span>":"<span class='title'>".hsc($plant['name'])."</span>".($post['time']>$time?"<span class='small minor'> (Осталось до созревание <span> ".time_left($post['time']-$time)."</span>)</span>":null)."")."";
echo "</div>";
echo "<div>";
if(isset($plant))
{
if($post['time']<=$time)
{
echo "";
echo "<a href='?farm&harvest=$post[id]'><img width='16' height='16' src='i/icons/harvest.png' alt='o'></a>";
echo "<hr>";
//agro.keo.su
}
else
{
if($ku['last_soil']!=0 && mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_soil` WHERE `id` = '$ku[last_soil]'"),0)!=0)$ls=mysql_fetch_array(mysql_query("SELECT * FROM `kolhoz_soil` WHERE `id` = '$ku[last_soil]'"));
echo "<div class='small minor'>".($post['time_soil']<=$time && $post['soil']==0 && $post['time']>$time?"<img width='16' height='16' src='i/icons/soil.png' alt='o'> ".(isset($ls)?"<a href='?farm&soil=$post[id]&select=$ls[id]'>Применить
<span>".hsc($ls['name'])."</span></a>, <a href='?farm&soil=$post[id]'><span>выбрать
удобрение</span></a>":"<a href='?farm&soil=$post[id]'>Удобрить</a>")."":"".($post['soil']==0 && $post['time']>$time?"Удобрение через ".time_left($post['time_soil']-$time)."":null)."")."</div>";
echo "<div class='small minor'>".($post['time_water']>$time && $post['time']>$time?" ".time_left($post['time_water']-$time)."":"".($post['time']>$time?"".($post['soil']==0 && $post['time_soil']>$time || $post['soil']==1?"<img alt='' width='16' height='16' src='i/icons/water.png'> <a href='?farm&water=$post[id]'>Убрать вредителя</a>":null)."":null)."")."</div>";
echo "<hr>";
}
}
else
{
echo "<span>";
if($ku['last_plant']!=0 && mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_plant` WHERE `id` = '$ku[last_plant]'"),0)!=0)$lp=mysql_fetch_array(mysql_query("SELECT * FROM `kolhoz_plant` WHERE `id` = '$ku[last_plant]'"));
echo "".($post['cultivator']==1?" ".(isset($lp)?"<a href='?farm&seat=$post[id]&select=$lp[id]'><img width='16' height='16' src='i/icons/seat.png' alt='o'> <span>".hsc($lp['name'])."</span></a> <a href='?farm&seat=$post[id]'><span></span></a><font color='black'>":"<a href='?farm&seat=$post[id]'>Посадить</a>")."":"<a href='?farm&cultivator=$post[id]'><span style='title'><img width='16' height='16' src='i/icons/dig.png' alt='o'></span></a>")."";
echo "<hr>";
echo "</div></li>";
}
if(isset($plant))unset($plant);
echo "</div><div style='clear:both'></div></li>";
}
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_ground` WHERE `id_user` = '$ku[id]'"),1)<43)echo "<li>
";
if($ku['sk']==0)echo "<g5><img width='55' height='75' src='i/f_001.png' alt='o' class='portrait'></g5>";
echo "<span class='kra' ><li>Новый участок</li></span></div><li><img width='16' height='16' src='i/icons/cart.png' alt='o'> <a href='?farm&new_ground'>Купить</a> за <span class='title'><img width='16' height='16' src='i/icons/ok.png' alt='o'><span>".cpg(mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_ground` WHERE `id_user` = '$ku[id]'"),0))."</span> Очков престижа</span></div><div style='clear:both'></div></li></li>";
if ($k_page>1)str("?farm&",$k_page,$page);
if($ku['last_plant']!=0 && mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_plant` WHERE `id` = '$ku[last_plant]'"),0)!=0)$lp=mysql_fetch_array(mysql_query("SELECT * FROM `kolhoz_plant` WHERE `id` = '$ku[last_plant]'"));
if($ku['last_soil']!=0 && mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_soil` WHERE `id` = '$ku[last_soil]'"),0)!=0)$ls=mysql_fetch_array(mysql_query("SELECT * FROM `kolhoz_soil` WHERE `id` = '$ku[last_soil]'"));
echo "<hr>";
echo "<ul class='ptm'><li><img width='16' height='16' src='i/icons/seat.png' alt='o'> <a href='?farm&change_plant'>Сменить семена</a>: <span>".(isset($lp)?"".hsc($lp['name'])."":"-")."</span></li>";
echo "<li><img width='16' height='16' src='i/icons/soil.png' alt='o'> <a href='?farm&change_soil'>Сменить удобрение</a>: <span>".(isset($ls)?"".hsc($ls['name'])."":"-")."</span></li>";
if(isset($_GET['sk']))
{
mysql_query("UPDATE `kolhoz_user` SET `sk` = '".($ku['sk']==1?"0":"1")."' WHERE `id` = '$ku[id]'");
header("Location:?farm");
}
echo "<li><font size='2'><a href='?farm1&sk'><span>".($ku['sk']==0?"<font color='green'>Скрыть изображение растений</font>":"<font color='black'>Показать изображение растений</font>")."</span></a></font></li>";
echo "<li><div><img width='16' height='16'src='i/icons/refresh.png' alt='o'> <a href='? farm&reflesh=".rand (99999,99999999)."'>Обновить</a></
div></li>";
echo "<div class='content'>";
echo "<div class='block'>";
echo "<b><font color='black'>Город</font></b>";
echo "<li><div><img width='16'
height='16'src='i/i/ma.png' alt='o'>
<a href='?shop'>Магазин</a></div></li>";
echo "<li><div><img width='16'height='16'src='i/sklad.png' alt='o'><a href='?sklad'> Склад</a></div></li>";
echo "<li><img
width='12'height='12'src='i/ring.png' alt='o'><a href='?zags'> ЗАГС";
if($ku['level']<5)echo "</a><font color='red'> с 5 уровня</
font></li>";
if($ku['level']>=1)echo
"<li><img width='12'
height='12' src='i/fortune.png'
alt='o'> <a href='?koleso'>Колесо удачи</a></li>";
echo "<b><font color='black'> Общественные места</font></b>";
echo "<li><div><img
width='12'height='12'src='i/dot.png' alt='o'><a href='?forum'> Форум</a></div></li>";
echo "<li><div><img
width='12'height='12'src='i/dot.png' alt='o'><a href='?chat'> Чат</a></div></li>";
echo "<b><font color='black'>Хозяйство</font></b>";
echo "<li><div><img width='12'height='12'src='i/dot.png'
alt='o'><a href='?farm'> Ферма</a></div></li>";
echo "<li><div><img
width='12'height='12'src='i/tree.png'
alt='o'><a href='?mypetfarm'> Сад </a>";
if($ku['level']<30)echo "<font color='red'> с 30 уровня</
font> </a></div></li>";
echo "<li><div><img width='12'height='12'src='i/vodoem.png'
alt='o'><a href='?vodoem_771351354'> Озеро </a>";
if($ku['level']<40)echo "<font color='red'>с 40 уровня</
font></a></div></li>";
if($ku['scarecrow_time']>$time)echo'<font color="black"><div><img width="16" height="16" src="/i/icons/experience.png" alt="o"/><span><a href="?shop=scarecrow">Менеджер</a></span><sup><b><font size="0.1em">'.time_left($ku['scarecrow_time']-time()).'</b></sup></font></font></span>
</div>';
if($ku['gardener']==3)echo'<font color="black"><div><img width="16" height="16" src="/i/cat.png" alt="o"/><span><a href="?shop=gardener&id=3">Кот</a></span><sup><b><font size="0.1em">'.time_left($ku['garden_time']-time()).'</b></sup></font></font></span>
</div>';
echo "<br><li><img width='12' height='12'
src='i/on.png' alt='o'> <a href='?
online=$ku[id]'>Кто в игре</a> <span class='title'></span></li>";
include_once 'inc/foot.php';
?>$time?