Файл: test.zfarm.mobi/mystyleuser/linkuserindex.php
Строк: 160
<?php
what(0, 'ferma');
$time_v = $time;
if(isset($_GET['id']) && num($_GET['id'])!=NULL && mysql_result(mysql_query("SELECT COUNT(*) FROM `mystyle_farm` WHERE `id` = '".num($_GET['id'])."' AND `user` = '".$user['id']."' AND `time` <= '".$time_v."'LIMIT 1"),0)!=0){
$img = '';
$farm = mysql_fetch_array(mysql_query("SELECT * FROM `mystyle_farm` WHERE `user` = '".$user['id']."' AND `id` = '".num($_GET['id'])."' AND `time` <= '".$time."'"));
if(!empty($farm['img'])){
$sclad = mysql_fetch_array(mysql_query("SELECT * FROM `mystyle_sklad` WHERE `img` = '".$farm['img_sclad']."' AND `user` = '".$user['id']."'"));
$rat = $farm['exp'];
if(num($_GET['page']))$page = 'page='.num($_GET['page']).'';
$msclub = 0;
$avatar = 0;
$mozgi_exp_sql = 0;
if(isset($user['msclub']))$msclub = (($rat/100)*200);
if(isset($mozgi_exp))$mozgi_exp_sql = (($rat/100)*200);
if(isset($user['avatar_exp']))$avatar = (($rat/100)*$user['avatar_exp']);
$rat_user = $msclub+$avatar+$mozgi_exp_sql;
if($rat_user == 0)$rat = $rat;
else $rat=$rat_user;
$cerdce = $user['sunduk2']+3;
$rating = $user['rating']+$rat;
$money = $user['money']+$farm['money'];
$col_ferma_q = $user['col_ferma']+1;
///////// Лог Пользователя ///// By MyStyle
$text = 'Урожай перемещён в склад. Опыта: '.$rat.' + Монет: '.$farm['money'].'';
$_SESSION['msg'] = $text;
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `mystyle_club` WHERE `type` = '".num($user['msclub'])."'"),0)<1){}else{
$club = mysql_fetch_array(mysql_query("SELECT * FROM `mystyle_club` WHERE `id` = '".num($user['msclub'])."'"));
$cuser = mysql_fetch_array(mysql_query("SELECT * FROM `mystyle_cuser` WHERE `user` = '".num($user['id'])."'"));
$col = $club['rating']+$rat;
$col2 = $cuser['rating']+$rat;
mysql_query("UPDATE `mystyle_club` SET `rating` = '".$col."' WHERE `id` = '".$user['msclub']."' LIMIT 1");
mysql_query("UPDATE `mystyle_cuser` SET `rating` = '".$col2."' WHERE `user` = '".$user['id']."' LIMIT 1");
}
mysql_query("UPDATE `mystyle_user` SET `money` = '".$money ."', `rating` = '".$rating."', `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` = '".$time."', `img` = '".$img."' WHERE `id` = '".$farm['id']."' AND `user` = '".$user['id']."'");
header("Location: ./?$page");
exit;
}else{
header("Location: ./?$page");
exit;
}
}else{
$k_post = mysql_result(mysql_query("SELECT COUNT(user) FROM `mystyle_farm` WHERE `user` = '".$user['id']."'"),0);
if ($k_post==0)
{
echo "Пусто!";
}
$k_page=k_page($k_post,$user['set']);
$page=page($k_page);
$start=$user['set']*$page-$user['set'];
$q=mysql_query("SELECT * FROM `mystyle_farm` WHERE `user` = '".$user['id']."' LIMIT $start, $user[set]");
while($post=mysql_fetch_array($q))
{
if($page > 1) $pad = '&page='.$page.'';
$plant = mysql_fetch_array(mysql_query("SELECT * FROM `mystyle_down` WHERE `id` = '".$user['id_plant_zombi']."' AND `level` <= '".$user['level']."'"));
@$bte = $post['time']-time();
@$timr = $bte/$post['time_left']*100;
if($post['img']){
echo '<li><div style="border: 1px solid #005f8a; margin: 4px 0; border-radius: 4px; background-color: #004272">
<img class="portrait pt6 pl6 pr6 center kartinki_div" width="60" height="60" src="images/zombi/cemena/'.$post['img'].'" alt="" />
<div class="pt6"><span class="whiteBoldLink"><span class="level">'.$post['name'].'</span> ';
if($user['s_redpack_small'] && $post['time'] > time()) echo '<a class="whiteBoldLink fr beauty" href="?linkredpacksmall='.$post['id'].''.$pad.'"><img width="15" height="15" src="images/s_redpack_small.png" alt="" /> Удобрить</a> (- <span class="level">'.$user['udobrenie'].' ч.</span>) ';
echo '</span><br />';
if($post['voda'] < time() && $post['time'] > time()) echo '<a class="whiteBoldLink fr beauty" href="?watertheplant='.$post['id'].''.$pad.'"><img width="24" height="24" src="images/voda.png" alt="" />Полить</a><div></div>';
echo '</div><br />';
if($post['time'] < time()){}else{
echo '<div class="fr" style="padding: 5px 0 0 5px; width: 50%;">';
echo 'Осталось: '.time_left($post['time']-$time).'';
echo '<div><div><div style="width: 100%;">
<div class="expBorder">
<div class="expline2" style="width:'.$timr.'%;"></div>
</div></div></div></div></div>';
}
if($post['time'] < time()){
echo '<a class="btnp fr" href="?id='.$post['id'].''.$pad.'"><img width="16" height="16" src="images/nowild.png" alt="" /> Собрать урожай</a>';
}else{
echo '<div style="clear:both"></div>';
}
}else{
if($user['id_plant_zombi'])echo url('btnp fr', '?linkdown&linkgood='.$plant['id'].'&id='.$post['id'].''.$pad.'', 'Посадить '.$plant['name'].'<div style="clear:both"></div><div style="clear:both"></div>');
echo '<li><div style="border: 1px solid #005f8a; margin: 4px 0; border-radius: 4px; background-color: #004272">
<img class="portrait pt6 pl6 pr6 center kartinki_div" width="60" height="60" src="images/zombi/m_flower1.png" alt="" />';
echo '<div class="pt6"><span class="whiteBoldLink">Не посажено.</span><br /><img width="16" height="16" src="images/nowild.png" alt="" /> <a href="?linkdown='.$post['id'].''.$pad.'">Посадить</a> растение?<div style="clear:both"></div><div style="clear:both"></div>';
echo '</div></div></li>';
}
echo '<div style="clear:both"></div></div>';
}
echo '</div>';
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `mystyle_farm` WHERE `user` = '".$user['id']."'"),0)<20)echo "<li style="border: 1px solid #005f8a; margin: 4px 0; border-radius: 4px; background-color: #004272"><img class="portrait pt6 pl6 pr6 center kartinki_div" width="60" height="60" src="images/zombi/m_flower1.png" alt="" /><div><span class='title'>Новая клумба</span></div><div><img width='16' height='16' src='images/zombi/cash.png' alt='o'> <a href='?newgardenbed'><span class="money nobr textshadow">Купить</span></a><br />Стоимость <span class='title'><img width='16' height='16' src='images/zombi/cash.png' alt='o'><span>".cpg(mysql_result(mysql_query("SELECT COUNT(*) FROM `mystyle_farm` WHERE `user` = '".$user['id']."'"),0))."</span> зомби баксов</span></div><div style='clear:both'></div></li>";
echo '<a class="btn" href="?linkredpacksmallshop"><img width="16" height="16" src="images/s_redpack_small.png" alt="" /> Удобрений '.$user['s_redpack_small'].'</a>';
if($user['udobrenie']<12){echo '<a href="?linkredpacksmallupload" class="btn"><img src="images/icons/arrow_up.png" alt="0" title=""/> Увеличить время удобрения</a>';}
if ($k_page>1)str("?",$k_page,$page);
}
?>