Файл: zfarm.mobi/inc/farm/myfarm.php
Строк: 293
<?
$title='Грядки';
include_once $_SERVER['DOCUMENT_ROOT'].'/inc/system/config.php';
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:/garden/");
exit;
}
else err_game("Для начала вступите в колхоз.");
}
include_once $_SERVER['DOCUMENT_ROOT'].'/inc/user/Chest.php';
echo"<div class='rzd2'></div><div class='menuin2'>";
echo "<div class='title'>Грядки</h2></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 "<div class='content'>";
echo "<div class='div'>";
include'../p_str.php';
if($ku['str'] == 5) echo "<div><img src='/img/icons/up.png' alt='o'> <a href='/garden/LinkUserGoUpProfileGetSetting/'>Компактный вид</a></div>"; if($ku['str'] == 50) echo "<div><img src='/img/icons/down.png' alt='o'> <a href='/garden/LinkUserGoDownProfileGetSetting/'>Компактный вид</a></div>"; if($ku['str'] == 5) { echo "<a href='/garden/'><img src='/img/icons/refresh.png' alt='o'></a> "; }else{ echo "<div><img src='/img/icons/refresh.png' alt='o'> <a href='/garden/'>Обновить</a></div>"; }
if($ku['str'] == 5) {
if($ku['hydropinics_time']>$time)echo "<a class='epic' href='/shop/hydropinics'><img src='/img/icons/hydropinics.png' alt='o'></a> "; }else{ if($ku['hydropinics_time']>$time)echo "<li><img src='/img/icons/hydropinics.png' alt='o'> <a class='epic' href='/shop/hydropinics'>Гидропоника</a><span class='minor'> $ku[hydropinics_type]% на <span>".time_left($ku['hydropinics_time']-$time)."</span></span></li>"; }
if($ku['str'] == 5) {
if($ku['scarecrow_time']>$time)echo "<a class='epic' href='/shop/carecrow'><img src='/img/icons/scarecrow.png' alt='o'></a> "; }else{ if($ku['scarecrow_time']>$time)echo "<li><img src='/img/icons/scarecrow.png' alt='o'> <a class='epic' href='/shop/scarecrow'>Пугало</a><span class='minor'> на <span>".time_left($ku['scarecrow_time']-$time)."</span></span></li>"; }
if($ku['str'] == 5) {
if($ku['time_shmel']>$time)echo "<a class='epic' href='/shop/helicopter/1'><img alt='o' src='/img/icons/heli1n.png'></a> "; }else{ if($ku['time_shmel']>$time)echo "<li><img alt='o' src='/img/icons/heli1n.png'> <a class='epic' href='/shop/helicopter/1'>Шмель</a><span class='minor'> на <span>".time_left($ku['time_shmel']-$time)."</span></span></li>"; }
if($ku['str'] == 5) {
if($ku['time_yastreb']>$time)echo "<a class='epic' href='/shop/helicopter/2'><img alt='o' src='/img/icons/heli2n.png'></a> "; }else{ if($ku['time_yastreb']>$time)echo "<li><img alt='o' src='/img/icons/heli2n.png'> <a class='epic' href='/shop/helicopter/2'>Ястреб</a><span class='minor'> на <span>".time_left($ku['time_yastreb']-$time)."</span></span></li>"; }
if($ku['str'] == 5) {
if($ku['time_drakon']>$time)echo "<a class='epic' href='/shop/helicopter/3'><img alt='o' src='/img/icons/heli3n.png'></a> "; }else{ if($ku['time_drakon']>$time)echo "<li><img alt='o' src='/img/icons/heli3n.png'> <a class='epic' href='/shop/helicopter/3'>Дракон</a><span class='minor'> на <span>".time_left($ku['time_drakon']-$time)."</span></span></li>"; }
if($ku['str'] == 5) {
if($ku['gardener_time']>$time)echo "<a class='epic' href='/gardener/1'><img alt='o' src='/img/icons/iarilo.png'></a> "; }else{ if($ku['gardener_time']>$time)echo "<li><img alt='o' src='/img/icons/iarilo.png'> <a class='epic' href='/gardener/1'>Ярило</a><span class='minor'> на <span>".time_left($ku['gardener_time']-$time)."</span></span></li>"; }
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_ground` WHERE `id_user` = '$ku[id]' AND (`time` < '$time' OR `time` = '$time') AND `id_plant` != '0'"),0)!=0 && $ku['harvester']>0)echo "<div><img src='/img/icons/harvest.png' alt='o'> <a href='/garden/harvestall/'>Собрать все</a></div>";
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_ground` WHERE `id_user` = '$ku[id]' AND `soil` = '0' AND (`time_soil` = '$time' OR `time_soil` < '$time') AND `id_plant` != '0' AND `time` > '$time'"),0)!=0 && $ku['soiler']>0)echo "<div><img src='/img/icons/soil.png' alt='o'> <a href='/garden/soilall/'>Удобрить все</a></div>";
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_ground` WHERE `id_user` = '$ku[id]' AND `id_plant` != '0' AND (`time_water` = '$time' OR `time_water` < '$time') AND `time` > '$time' AND (`soil` = '0' AND `time_soil` > '$time' OR `soil` = '1')"),0)!=0 && $ku['irregate']>0)echo "<div><img src='/img/icons/water.png' alt='o'> <a href='/garden/waterall'>Полить все</a></div>";
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_ground` WHERE `id_user` = '$ku[id]' AND `id_plant` = '0' AND `cultivator` = '1'"),0)!=0 && $ku['seeder']>0)echo "<div><img src='/img/icons/seat.png' alt='o'> <a href='/garden/seatall/'>Засеять все</a></div>";
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_ground` WHERE `id_user` = '$ku[id]' AND `id_plant` = '0' AND (`time` = '$time' OR `time` < '$time') AND `cultivator` = '0'"),0)!=0 && $ku['cultivator']>0)echo "<div><img src='/img/icons/dig.png' alt='o'> <a href='/garden/digall/'>Вскопать все</a></div>";
echo "<ul>";
////ГРЯДКИ
$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,$ku['str']);
$page=page($k_page);
$start=$ku['str']*$page-$ku['str'];
$num=($page-1)*$ku['str'];
$q=mysql_query("SELECT * FROM `kolhoz_ground` WHERE `id_user` = '$ku[id]' ORDER BY `id` DESC LIMIT $start, $ku[str]");
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]'"));
echo "<li><img style='border-radius: 5px' width='48' height='48' src='/img/".(!isset($plant)?"".($post['cultivator']==1?"dirt_new.jpg":"dirt2_new.jpg")."":"plants/$plant[img].png")."' alt='o' class='portrait'>";
echo "<div>";
echo "".(!isset($plant)?"<span class='n'>".($post['cultivator']==1?"Земля, готовая к посеву":"Необработанная земля")."</span>":"<span class='n'>".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 "<img src='/img/icons/harvest.png' alt='o'> <a href='/garden/harvest/$post[id]/'>Собрать урожай</a>";
}
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 src='/img/icons/soil.png' alt='o'> ".(isset($ls)?"<a href='/garden/fertilizer/$post[id]/select/$ls[id]/'>Применить
<span>".hsc($ls['name'])."</span></a>, <a href='/garden/fertilizer/$post[id]/'><span>выбрать
удобрение</span></a>":"<a href='/garden/fertilizer/$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='' src='/img/icons/water.png'> <a href='/garden/water/$post[id]/'>Полить</a>":null)."":null)."")."</div>";
}
}
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?"<img src='/img/icons/seat.png' alt='o'> ".(isset($lp)?"<a href='/garden/seat/$post[id]/select/$lp[id]/'>Посадить <span>".hsc($lp['name'])."</span></a>, <a href='/garden/seat/$post[id]/'><span>выбрать семена</span></a>":"<a href='/garden/seat/$post[id]/'>Посадить</a>")."":"<img src='/img/icons/dig.png' alt='o'> <a href='/garden/dig/$post[id]/'><span style='n'>Вскопать</span></a>")."";
echo "</span>";
}
if(isset($plant))unset($plant);
echo "</div><div style='clear:both'></div></li>";
}
echo'<div style="margin-top:2px"></div>';
if ($k_page>1)str("/garden/",$k_page,$page); // Вывод страниц
echo'<div style="margin-top:10px"></div>';
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_ground` WHERE `id_user` = '$ku[id]'"),0)<40)echo "<li><img style='border-radius: 5px' width='48' height='48' src='/img/dirt_buy.jpg' alt='o' class='portrait'><div><span class='n'>Новая земля</span></div><div><img src='/img/icons/cart.png' alt='o'> <a href='/garden/buyBed/'>Купить</a> за <span class='n'><img src='/img/icons/ruby.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>";echo "</ul>";
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'<div style="margin-top:1px"></div>';
echo "<ul class='ptm'><li><img src='/img/icons/seat.png' alt='o'> <a href='/garden/plant/'>Сменить растение</a>: <span>".(isset($lp)?"".hsc($lp['name'])."":"-")."</span></li>";
echo'<div style="margin-top:1px"></div>';
echo "<li><img src='/img/icons/soil.png' alt='o'> <a href='/garden/soil/'>Сменить удобрение</a>: <span>".(isset($ls)?"".hsc($ls['name'])."":"-")."</span></li>";
echo "".($ku['time_cp']>$time?"<li><img src='/img/icons/cross.png' alt='o'> До бесплатной очистки: <span>".time_left($ku['time_cp']-$time)."</span></li><li><span><img src='/img/icons/tick.png' alt='o'> <a href='/garden/clean/'><span>Очистить грядки</span></a>(<span>Стоимость</span>: <span><img src='/img/icons/ruby.png' alt='o'> <span
class='n'>".($ku['count_cp']*10)."</span></span>)</span></li>":"<li><img src='/img/icons/cross.png' alt='o'> <a href='/garden/clean/'>Очистить грядки</a></li>")."</ul>";
if($mc['id']>0){echo"<li class='pt'><img src='/img/icons/heli4n.png' alt='o'> <a href='/kolhoz/hangar/$mc[id]/'>Вызвать вертолет</a></li>";}
echo '</ul></div></div>';
echo"</div><div class='rzd2'></div>";
include_once $_SERVER['DOCUMENT_ROOT'].'/inc/system/foot.php';
?>