Файл: test.zfarm.mobi/mystylepostr/12.php
Строк: 94
<?php
/////////////////////////
/*
Author MyStyle ZomBi.Biz
Год 2013 Права предоставлены автору Шехову Виталию Александровичу
http://vk.com/online_user
*/
/////////////////////////
if($user['postroyki12'] == 12){}else{
header("Location: ./");
exit;
}
if(isset($_GET['brigada']) && mysql_result(mysql_query("SELECT COUNT(*) FROM `mystyle_farm` WHERE `user` = '$user[id]' AND (`time` < '$time' OR `time` = '$time') AND `time` != '0'"),0)!=0){
$all = mysql_query("SELECT * FROM `mystyle_farm` WHERE `user` = '".$user['id']."'");
while($post=mysql_fetch_array($all))
{
$or = $or+$post['exp'];
$rat = $or;
$avatar = 0;
$mozgi_exp_sql = 0;
if(isset($mozgi_exp))$mozgi_exp_sql=(($rat/100)*200);
if(isset($user['avatar_exp']))$avatar=(($rat/100)*$user['avatar_exp']);
$rat_user = $avatar+$mozgi_exp_sql;
if($rat_user==0)$rat=$rat;
else $rat=$rat_user;
if($post['img']){
if($post['time'] < time()){
$img = '';
$farm = mysql_fetch_array(mysql_query("SELECT * FROM `mystyle_farm` WHERE `user` = '".$user['id']."' AND `id` = '".num($post['id'])."' AND `time` <= '".$time."'"));
$sclad = mysql_fetch_array(mysql_query("SELECT * FROM `mystyle_sklad` WHERE `img` = '".$farm['img_sclad']."' AND `user` = '".$user['id']."'"));
$cerdce = $user['sunduk2']+3;
$money = $user['money']+$farm['money'];
$col_ferma_q = $user['col_ferma']+1;
$rae = $user['rating']+$rat;
mysql_query("UPDATE `mystyle_user` SET `money` = '".$money ."', `rating` = '".$rae."', `sunduk2` = '".$cerdce."', `col_ferma` = '".$col_ferma_q."' WHERE `id` = '".$user['id']."' LIMIT 1");
if($farm['img_sclad'] == $sclad['img']){
$vol = $sclad['col']+1;
mysql_query("UPDATE `mystyle_sklad` SET `col` = '".$vol."', `name` = '".$farm['name']."' WHERE `id` = '".$sclad['id']."' AND `user` = '".$user['id']."'");
include 'mystylecollect/mystylecollectionsrand.php';
$rand1 = rand(1,10);
$rand2 = rand(1,10);
$rand3 = rand(1,211);
if($rand1 == $rand2){
$collections = mysql_fetch_array(mysql_query("SELECT * FROM `mystyle_collections` WHERE `id` = '".$rand3."'"));
$img_coll = ''.$collections['img'].'.png';
mysql_query("INSERT INTO `mystyle_sklad` SET `user` = '".$user['id']."', `name` = '".$collections['name']."', `img` = '".$img_coll."', `money` = '".$collections['money']."', `type` = '".num(2)."', `col` = '".num(1)."'");
}
}else{
include 'mystylecollect/mystylecollectionsrand.php';
$rand1 = rand(1,20);
$rand2 = rand(1,30);
$rand3 = rand(1,211);
if($rand1 == $rand2){
$collections = mysql_fetch_array(mysql_query("SELECT * FROM `mystyle_collections` WHERE `id` = '".$rand3."'"));
$img_coll = ''.$collections['img'].'.png';
mysql_query("INSERT INTO `mystyle_sklad` SET `user` = '".$user['id']."', `name` = '".$collections['name']."', `img` = '".$img_coll."', `money` = '".$collections['money']."', `type` = '".num(2)."', `col` = '".num(1)."'");
}
mysql_query("INSERT INTO `mystyle_sklad` SET `user` = '".$user['id']."', `name` = '".$farm['name']."', `img` = '".$farm['img_sclad']."', `money` = '".$farm['money']."', `type` = '".num(1)."', `col` = '".num(1)."'");
}
mysql_query("UPDATE `mystyle_farm` SET `voda` = NULL, `name` = NULL, `exp` = NULL, `money` = NULL, `time` = '0', `img` = '".$img."' WHERE `id` = '".$farm['id']."' AND `user` = '".$user['id']."'");
/* На выше указанном коде мы собираем урожай каторый созрел,
нижний код будет выполнять действие посадки урожая который
сожал пользователь
*/
$plant = mysql_fetch_array(mysql_query("SELECT * FROM `mystyle_down` WHERE `id` = '".$user['id_plant_zombi']."' AND `level` <= '".$user['level']."'"));
$fer = mysql_fetch_array(mysql_query("SELECT * FROM `mystyle_down` WHERE `id` = '".num($plant['id'])."' AND `level` <= '".$user['level']."'"));
$time_got = $time+$fer['time'];
mysql_query("UPDATE `mystyle_farm` SET `name` = '".$fer['name']."', `time` = '".$time_got."', `exp` = '".$fer['exp']."', `money` = '".$fer['money']."', `img` = '".$fer['img']."', `time_left` = '".$fer['time']."', `img_sclad` = '".$fer['img_sclad']."' WHERE `time` = '".num(0)."' AND `user` = '".$user['id']."'");
}
}
}
$text = 'Опыта: '.$rat.'';
$_SESSION['msg'] = $text;
header("Location: ./?link12");
exit;
}else{
echo '<div class="feedbackPanel">Бригада</div>';
$col = mysql_result(mysql_query("SELECT COUNT(*) FROM `mystyle_farm` WHERE `user` = '$user[id]' AND (`time` < '$time' OR `time` = '$time') AND `time` != '0'"),0);
echo '<img class="portrait pt6 pl6 pr6 center" width="60" height="60" src="images/postroyki/m_brigada.png" alt="" /><br />';
echo '<span class="btn">Бригада активируется только тогда, когда нужно собрать урожай! Для сбора урожая грядок у вас '.$col.'</span>';
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `mystyle_farm` WHERE `user` = '$user[id]' AND (`time` < '$time' OR `time` = '$time') AND `time` != '0'"),0)!=0)echo '<a href="./?link12&brigada" class="btn">Собрать все и посадить</a>';
echo '<div class="feedbackPanel">Зачем бригада нужна? Бригада собирает со всех ваших грядок урожай, переносит в склад и сразу сожает. И единственное она не берет монеты за посадку урожая!</div>';
}
?>