<?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']='Rastamania';
include_once '../../sys/inc/thead.php';
title();
aut();
################################################################################
if(!isset($user) || !isset($_GET['id'])){
header("Location:/index.php");
break;
}
///
function sictime($timediff){
$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));
$time_1="$hourfield ч. $minutefield м. $secondfield сек.";
return $time_1;
}

$id=abs(intval($_GET['id']));
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `rastamania` WHERE `ids`='".$user['id']."' AND `id`='".$id."'"),0)!='0'){
$u=mysql_result(mysql_query("SELECT `time_r` FROM `rastamania` WHERE `id`='".$id."'"),0);
if($u<=time()){
$times=time()+2500;
mysql_query("UPDATE `rastamania` SET `game_rost`=`game_rost`+7, `time_r`=".$times." WHERE `id`='".$id."' LIMIT 1");
echo "<center>";
echo '<table width="273" height="130" style="color: white; background-image: url(img/dialogBut2.png);" border="0">';
echo "<td valign='bottom'><br />+7 см.<br />к вашему <br />росту травы!<br /><br /><br /></td></table>";
echo "</center>";
}else{
$sic=$u-time();
echo "Вы не можете так часто поливать траву!<br />Подождите еще ".sictime($sic)."<br />\n";
}
}else{
echo 'аяяй!';
}
echo "<div class='aut'><a href='index.php'>Назад</a></div>";
################################################################################
include_once '../../sys/inc/tfoot.php';
?>