Файл: soc-set/moduls/fermer/my2.php
Строк: 67
<?php
if(isset($_GET['add_ok'])) {
echo DIV_MSG . 'Грядка приобретена!' . CLOSE_DIV;
}
if(isset($_GET['udobr_ok'])) {
echo DIV_MSG . 'Растение удобрено!' . CLOSE_DIV;
}
if(isset($_GET['add_no'])) {
echo DIV_ERROR . 'Ваш уровень должен быть больше 5!' . CLOSE_DIV;
}
if(isset($_GET['gr_add']) && $user['fermer_money']>=5000) {
if($user['fermer_oput'] >= 3000) {
mysql_query("UPDATE `users` SET `fermer_money` = `fermer_money`- '5000' WHERE `user_id` = $user[user_id] LIMIT 1");
mysql_query("INSERT INTO `fermer_gr` (`semen`, `id_user`) VALUES ( '0', '".$user['user_id']."') ");
header('Location: ' . HOME . '/fermer/?add_ok');
} else {
header('Location: ' . HOME . '/fermer/?add_no');
}
}
if(isset($_GET['add'])){
echo DIV_BLOCK . "Стоимость одной грядки составляет 5000 монет";
echo "<form method='post' action='?gr_add'>n";
echo "<input type='submit' name='save' value='Приобрести!' />n";
echo "</form>n" . CLOSE_DIV;
}
$doggy = $user['fermer_doggy'];
include 'inc/str.php';
include 'inc/popular.php';
if($karma == 0) {
echo '<a href="original_appearance.php"><b>Карма</b></a>: 0<br />';
} else {
echo '<a href="original_appearance.php"><b>Карма</b></a>: '.$karma.' %<br />';
}
include_once 'inc/pop.php';
if($socstatus >= 0 && $socstatus <= 499) {
echo '<a href="area.php"><b>Статус</b></a>: Колхозник ('.$socstatus.' %)';
} elseif($socstatus >= 500 && $socstatus <= 999) {
echo '<a href="area.php"><b>Статус</b></a>: Продвинутый ('.$socstatus.' %)';
} elseif($socstatus >= 1000 && $socstatus <= 1499) {
echo '<a href="area.php"><b>Статус</b></a>: Первый на деревне ('.$socstatus.' %)';
}
echo CLOSE_DIV . DIV_BLOCK;
if($doggy == 1) {
echo '<a href="dog.php"><img src="'.HOME.'/moduls/fermer/dog3.png"></a>
<a href="reeltor.php?p=house"><img src="'.HOME.'/moduls/fermer/imghouse/house.gif"></a>
<a href="storage.php"><img src="'.HOME.'/moduls/fermer/sklad.png"></a>
<br />';
} else {
echo '<a href="dog.php"><img src="'.HOME.'/moduls/fermer/dog1.png"></a>
<a href="reeltor.php?p=house"><img src="'.HOME.'/moduls/fermer/imghouse/house.gif"></a>
<a href="storage.php"><img src="'.HOME.'/moduls/fermer/sklad.png"></a><br />';
}
$k_post=mysql_result(mysql_query("SELECT COUNT(*) FROM `fermer_gr` WHERE `id_user` = '$user[user_id]'"),0);
$res = mysql_query("select * from `fermer_gr` WHERE `id_user` = '$user[user_id]'");
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 "<b></b> <a href='".HOME."/fermer/gr/$post[id]/'><img src='".HOME."/moduls/fermer/img/$post[semen].gif' ></a>";
}
echo "<a href='".HOME."/fermer/?add'><img src='".HOME."/moduls/fermer/2_0_0_0(01).gif' ></a>";
echo "<div class='ferm6'>.</div></div>";
?>