' .$textl.'');
echo ('
');
require_once ('../incfiles/end.php');
exit;
}
$user = mysql_fetch_assoc(mysql_query("SELECT * FROM `users` WHERE `id` = '$user_id' LIMIT 1"));
$total = mysql_result ( mysql_query ( "SELECT COUNT(*) FROM `gratka` WHERE `ferma`='" .$id. "'" ), 0 );
$ferma = mysql_fetch_assoc(mysql_query("SELECT * FROM `ferma` WHERE `id` = '$id' LIMIT 1"));
if(mysql_num_rows(mysql_query ( "SELECT * FROM `ferma` WHERE `id`='" . $id . "' AND `user` = '" .$user_id. "' LIMIT 1" )) == 0){
$textl = 'Ошибка';
require_once ('../incfiles/head.php');
echo ('
' .$textl.'
');
echo ( '' );
echo ( '' );
require_once ('../incfiles/end.php');
exit;
}
/*
if(!preg_match("|^[\d]+$|",$_GET['id']))
{ $textl = 'Ошибкa';
require_once ('../incfiles/head.php');
echo ('
' .$textl.'
');
echo ('');
require_once ('../incfiles/end.php');
exit;
}
*/
if ($total == 3 && $ferma['level'] == 1){ $textl = 'Ошибкa';
require_once ('../incfiles/head.php');
echo ('
' .$textl.'
');
echo ( '' );
echo ( '' );
require_once ('../incfiles/end.php');
exit; }
if ($total == 6 && $ferma['level'] == 2){ $textl = 'Ошибкa';
require_once ('../incfiles/head.php');
echo ('
' .$textl.'
');
echo ( '' );
echo ( '' );
require_once ('../incfiles/end.php');
exit;}
if ($total == 9 && $ferma['level'] == 3){ $textl = 'Ошибкa';
require_once ('../incfiles/head.php');
echo ('
' .$textl.'
');
echo ( '' );
echo ( '' );
require_once ('../incfiles/end.php');
exit;}
if ($total == 12 && $ferma['level'] == 4){ $textl = 'Ошибкa';
require_once ('../incfiles/head.php');
echo ('
' .$textl.'
');
echo ( '' );
echo ( '' );
require_once ('../incfiles/end.php');
exit;
}
if ($total == 15 && $ferma['level'] == 5){ $textl = 'Ошибкa';
require_once ('../incfiles/head.php');
echo ('
' .$textl.'
');
echo ( '' );
echo ( '' );
require_once ('../incfiles/end.php');
exit;}
if ($total == 18 && $ferma['level'] == 6){
$textl = 'Ошибкa';
require_once ('../incfiles/head.php');
echo ('
' .$textl.'
');
echo ( '' );
echo ( '' );
require_once ('../incfiles/end.php');
exit;}
if ($total == 21 && $ferma['level'] == 7){
$textl = 'Ошибкa';
require_once ('../incfiles/head.php');
echo ('
' .$textl.'
');
echo ( '' );
echo ( '' );
exit;}
if ($total == 24 && $ferma['level'] == 8){
$textl = 'Ошибкa';
require_once ('../incfiles/head.php');
echo ('
' .$textl.'
');
echo ( '' );
echo ( '' );
require_once ('../incfiles/end.php');
exit;}
if ($total == 27 && $ferma['level'] == 9){ $textl = 'Ошибкa';
require_once ('../incfiles/head.php');
echo ('
' .$textl.'
');
echo ( '' );
echo ( '' );
require_once ('../incfiles/end.php');
exit;}
$act = isset ( $_GET['act'] ) ? $_GET['act'] : NULL;
switch ($act){
default:
if ($ferma['user'] == $user_id) {
$textl = 'Создание грятки';
require_once ('../incfiles/head.php');
echo ('
' .$textl.'
');
echo ( 'Сдесь вы можете купить семена и посатить время созревание для каждого оваща (фрукта) разное количество разновитности семян зависит от бизнес уровня вашой фермы
' .$id. '
Ниже приведен список досупных вам семян и рядом цена семян.
' );
}
break;
case 'ok' :
//////Вредители!!
if ($ferma['level'] <= 5)
{
$vred = rand (0,8) ;
}
if ( $ferma['level'] > 6 )
{
$vred = rand (0,15) ;
}
/////////Вредители!!!
$textl = 'Грядка успешно посажена'; require_once ('../incfiles/head.php');echo ('' .$textl.'
');
$ima = intval ( $_POST['ima'] );
$semena = mysql_fetch_assoc(mysql_query("SELECT * FROM `semena` WHERE `id` = '" .$ima. "' LIMIT 1"));
if ($ferma['level'] >= $semena['level'] && $user['money'] >= $semena['cena']) {
mysql_query("UPDATE `users` SET `money`=`money`-'" .$semena['cena']. "' WHERE `id`='".$user_id."'");
mysql_query ( "INSERT INTO `gratka` ( `ferma`, `name`, `date`, `date2`, `dohot`, `semid`,`vred` ) VALUES ('" .$id. "', '" .$semena['name']. "', '" .time(). "', '" .(time() +$semena['date']). "', '" .$semena['cena2']."', '" .$semena['id']. "', '" .$vred."')" );
mysql_query("UPDATE `ferma` SET `dohot`=`dohot`+'" .$semena['cena2']. "' WHERE `id`='".$id."'");
mysql_query("UPDATE `users` SET `money`=`money`+'".$semena['cena2']."' WHERE `id`='".$user_id."'");
echo ( '' );
}
else {
echo ( '' );
}
}
echo ( '' );
require_once ('../incfiles/end.php');
?>