Файл: test.masteram.us/games/fermer/my.php
Строк: 95
<?php
include_once '../../sys/inc/start.php';
include_once '../../sys/inc/compress.php';
include_once '../../sys/inc/sess.php';
include_once '../../sys/inc/home.php';
include_once '../../sys/inc/settings.php';
include_once '../../sys/inc/db_connect.php';
include_once '../../sys/inc/ipua.php';
include_once '../../sys/inc/fnc.php';
include_once '../../sys/inc/user.php';
$set['title']='Моя ферма!';
include_once '../../sys/inc/thead.php';
title();
err();
if(isset($_GET['add_ok']))msg('Грядка приобретена!');
if(isset($_GET['udobr_ok']))msg('Растение удобрено!');
if(isset($_GET['add_no']))echo '<div class="err">Ваш уровень должен быть больше 5!</div>';
if(isset($_GET['gr_add']) && $user['fermer_money']>=5000)
{
if($level<5){
mysql_query("UPDATE `user` SET `fermer_money` = `fermer_money`- '5000' WHERE `id` = $user[id] LIMIT 1");
mysql_query("INSERT INTO `fermer_gr` (`semen`, `id_user`) VALUES ( '0', '".$user['id']."') ");
header('Location: my.php?add_ok');
}else{header('Location: my.php?add_no');}
}
include 'inc/str.php';
if(isset($_GET['add'])){
echo "Стоимость одной грядки составляет 5000$";
echo "<form method='post' action='?gr_add'>n";
echo "<input type='submit' name='save' value='Приобрести!' />n";
echo "</form>n";
}else{
$k_post=mysql_result(mysql_query("SELECT COUNT(*) FROM `fermer_gr` WHERE `id_user` = '$user[id]'"),0);
$k_page=k_page($k_post,$set['p_str']);
$page=page($k_page);
$start=$set['p_str']*$page-$set['p_str'];
$res = mysql_query("select * from `fermer_gr` WHERE `id_user` = '$user[id]' LIMIT $start, $set[p_str];");
while ($post = mysql_fetch_array($res)){
$semen=mysql_fetch_array(mysql_query("select * from `fermer_name` WHERE `id` = '$post[semen]' LIMIT 1"));
if($post['semen']==0){$name_gr='Пустая грядка';}else{$name_gr=$semen['name'];}
$vremja=$post['time']-$time;
$timediff=$vremja;
$oneMinute=60;
$oneHour=60*60;
$oneDay=60*60*24;
$dayfield=floor($timediff/$oneDay);
$hourfield=floor(($timediff-$dayfield*$oneDay)/$oneHour);
$minutefield=floor(($timediff-$dayfield*$oneDay-$hourfield*$oneHour)/$oneMinute);
$secondfield=floor(($timediff-$dayfield*$oneDay-$hourfield*$oneHour-$minutefield*$oneMinute));
if($dayfield>0)$day=$dayfield.'д. ';
if($time<$post['time'])$time_1="(".$day.$hourfield."ч. ".$minutefield."м.)";
else$time_1=" (<span class='off'>Пора собирать!</span>)";
if($post['semen']!=0 && $time>$post['time'] && $post['kol']==0)
{
$pt=rand($semen['rand1'],$semen['rand2']);
mysql_query("UPDATE `fermer_gr` SET `kol` = $pt WHERE `id` = $int LIMIT 1");
}
echo "<img src='img/$post[semen].gif' ><b>»</b> <a href='gr.php?id=$post[id]'>".$name_gr."</a>";
if($post['semen']!=0)
echo " ".$time_1."";
echo "<br/>n";
}
if ($k_page>1)str('?',$k_page,$page); // Вывод страниц
}
echo "<div class='foot'>";
echo "» <a href='my.php?add'>Купить грядку</a><br/>";
echo "« <a href='index.php'>Назад</a><br/>";
echo "</div>";
include_once '../../sys/inc/tfoot.php';
?>