Файл: test.zfarm.mobi/mystyleuser/linkdown.php
Строк: 121
<?php
/////////////////////////
/*
Author MyStyle ZomBi.Biz
Год 2013 Права предоставлены автору Шехову Виталию Александровичу
http://vk.com/online_user
*/
/////////////////////////
if(isset($_GET['linkgood']) && num($_GET['linkgood'])!=NULL && isset($_GET['id']) && num($_GET['id'])!=NULL && mysql_result(mysql_query("SELECT COUNT(*) FROM `mystyle_down` WHERE `id` = '".num($_GET['linkgood'])."' AND `level` <= '".$user['level']."' LIMIT 1"),0) && mysql_result(mysql_query("SELECT COUNT(*) FROM `mystyle_farm` WHERE `id` = '".num($_GET['id'])."' AND `user` = '".$user['id']."' LIMIT 1"),0)!=0){
$fer = mysql_fetch_array(mysql_query("SELECT * FROM `mystyle_down` WHERE `id` = '".num($_GET['linkgood'])."' AND `level` <= '".$user['level']."'"));
$les = mysql_fetch_array(mysql_query("SELECT * FROM `mystyle_farm` WHERE `id` = '".num($_GET['id'])."' AND `level` <= '".$user['level']."'"));
if($_SESSION['training'] == 'water')
{
$_SESSION['training'] = 'sun';
}
if(num($_GET['page']))$page = 'page='.num($_GET['page']).'';
$need=$fer['money']/2;
if($user['money']>=$need){
$time_got = $time+$fer['time'];
$needs = $user['money']-$need;
mysql_query("UPDATE `mystyle_user` SET `id_plant_zombi` = '".num($_GET['linkgood'])."', `money` = '".$needs."' WHERE `id` = '".$user['id']."' LIMIT 1");
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 `id` = '".num($_GET['id'])."' AND `user` = '".$user['id']."'");
$rat = 10;
$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;
$ret = $user['rating']+$rat;
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 `rating` = '".$ret."' WHERE `id` = '".$user['id']."' LIMIT 1");
///////// Лог Пользователя ///// By MyStyle
$text = 'Посадили: '.$fer['name'].' + <span class="level">'.$rat.'</span> <img width="16" height="16" alt="" title="" src="images/zombi/xp.png">';
$_SESSION['msg'] = $text;
header("Location: ./?$page");
exit;
}else{
err_money($need-$user['money']);
}
}elseif(isset($_GET['linkdown']) && num($_GET['linkdown'])!=NULL && mysql_result(mysql_query("SELECT COUNT(*) FROM `mystyle_farm` WHERE `user` = '".$user['id']."' AND `id` = '".num($_GET['linkdown'])."' AND `name` = '' LIMIT 1"),0)!=0){
$farm = mysql_fetch_array(mysql_query("SELECT * FROM `mystyle_farm` WHERE `id` = '".num($_GET['linkdown'])."'"));
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `mystyle_down`"),0);
$k_page=k_page($k_post,$user['set']);
$page=page($k_page);
$start=$user['set']*$page-$user['set'];
$q=mysql_query("SELECT * FROM `mystyle_down` LIMIT $start, $user[set]");
while($post=mysql_fetch_array($q))
{
//if(num($_GET['page']))$page = 'page='.num($_GET['page']).'';
$cena = $post['money']/2;
echo '<li class="emptyPanel"><span class="whiteBoldLink textshadow"><div>
<img class="portrait pt6 pl6 pr6 center kartinki_div" width="60" height="60" src="images/zombi/cemena/'.$post['img'].'" alt="" />
<span class="whiteBoldLink">'.$post['name'].'</span><br />
<span style="clear: both;">Уровень: '.$post['level'].'</span>
<br /><span class="pt6">Созреет через: '.time_left($post['time']).'</span>
<span class="whiteBoldLink fr">Даёт после сбора: <span><img width="16" height="16" alt="" title="" src="images/zombi/xp.png"> '.$post['exp'].'</span> <span>
<img width="16" height="16" alt="" title="" src="images/zombi/coins.png"> '.$post['money'].'</span></span>';
echo '<div style="clear:both"></div></div></li>';
if($user['level']>=$post['level']){
echo '<a class="btnwom" href="?linkdown&linkgood='.$post['id'].'&id='.num($_GET['linkdown']).'">Посадить
<span class="money nobr textshadow"><img width="16" height="16" src="images/zombi/coins.png" alt=""/> <span class="required">'.$cena.'</span></span>
</a>';
}
echo '</div></li>';
}
if ($k_page>1)str("?linkdown=".num($_GET['linkdown'])."&",$k_page,$page); // Вывод страниц
}else{
header("Location: ./");
exit;
}
?>