Файл: test.zfarm.mobi/Animals/linkanimals.php
Строк: 147
<?php
/////////////////////////
/*
Author MyStyle ZomBi.Biz
12/05/2013
*/
/////////////////////////
what(0, 'animal');
if($user['level']>=10) {}else{
header("Location: ./");
exit;
}
$time_v = $time;
if(isset($_GET['id']) && num($_GET['id'])!=NULL && mysql_result(mysql_query("SELECT COUNT(*) FROM `mystyle_amimals_user` WHERE `id` = '".num($_GET['id'])."' AND `user` = '".$user['id']."' AND `time` <= '".$time_v."'LIMIT 1"),0)!=0){
$farm = mysql_fetch_array(mysql_query("SELECT * FROM `mystyle_amimals_user` WHERE `id` = '".num($_GET['id'])."' AND `time` <= '".$time_v."'"));
$img = $farm['img'].'.png';
$sclad = mysql_fetch_array(mysql_query("SELECT * FROM `mystyle_sklad` WHERE `img` = '".$img."' AND `user` = '".$user['id']."'"));
if($farm['img_corm'] == 's_bean') $corm = $user['corm1'];
if($farm['img_corm'] == 's_grass') $corm = $user['corm2'];
if($farm['img_corm'] == 's_bean') $corm_s = 'corm1';
if($farm['img_corm'] == 's_grass') $corm_s = 'corm2';
$rat = $farm['exp'];
$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(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_user;
$col2 = $cuser['rating']+$rat_user;
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");
}
if($corm>=$farm['col']){
///////// Лог Пользователя ///// By MyStyle
$text = '+3 <img width="16" height="16" src="images/who_postroyki/s_bamboo.png" alt="" />, <img width="16" height="16" alt="" title="" src="images/zombi/xp.png"> '.$rat.'';
$_SESSION['msg'] = $text;
if($farm['img_corm'] == 's_bean') update_minus('corm1',$farm['col']);
if($farm['img_corm'] == 's_grass') update_minus('corm2',$farm['col']);
$cerdce = $user['sunduk2']+3;
$rating = $user['rating']+$rat;
$col_ferma_q = $user['col_zagony']+1;
mysql_query("UPDATE `mystyle_user` SET `rating` = '".$rating."', `sunduk2` = '".$cerdce."', `col_zagony` = '".$col_ferma_q."' WHERE `id` = '".$user['id']."' LIMIT 1");
$time_got = $time+21000;
if($img == $sclad['img']){
$vol = $sclad['col']+1;
update_sclad('id',$sclad['id'],'col',$vol);
update_sclad('id',$sclad['id'],'name',$farm['name']);
//////////////////////////////////////////////////////////////////
include 'mystylecollect/mystylecollectionsrand.php';
////// Получаем шaнс найти какуб-либо вещь ///////////////////////
$rand1 = rand(1,15); ///////// 1 - 15 ////////////////////////////
$rand2 = rand(1,15); ///////// 1 - 15 ////////////////////////////
$rand3 = rand(1,211);///////// 1 - 211////////////////////////////
if($rand1 == $rand2){
$collections = mysql_fetch_array(mysql_query("SELECT * FROM `mystyle_collections` WHERE `id` = '".$rand3."'"));
$img_coll = ''.$collections['img'].'.png';
insert_sclad('user',$user['id'],'name',$collections['name'],'img',$img_coll,'money',$collections['money'],'type',2,'col',1);
}
//////////////////////////////////////////////////////////////////
}else{
$money = $farm['money']/3;
insert_sclad('user',$user['id'],'name',$farm['name'],'img',$img,'money',$money,'type',1,'col',1);
//////////////////////////////////////////////////////////////////
include 'mystylecollect/mystylecollectionsrand.php';
////// Получаем шaнс найти какуб-либо вещь ///////////////////////
$rand1 = rand(1,15); ///////// 1 - 15 ////////////////////////////
$rand2 = rand(1,15); ///////// 1 - 15 ////////////////////////////
$rand3 = rand(1,211);///////// 1 - 211////////////////////////////
if($rand1 == $rand2){
$collections = mysql_fetch_array(mysql_query("SELECT * FROM `mystyle_collections` WHERE `id` = '".$rand3."'"));
$img_coll = ''.$collections['img'].'.png';
insert_sclad('user',$user['id'],'name',$collections['name'],'img',$img_coll,'money',$collections['money'],'type',2,'col',1);
}
//////////////////////////////////////////////////////////////////
}
update_animal_user('id',$farm['id'],'time',$time_got);
}else{
$no_corm = $farm['col']-$corm;
///////// Лог Пользователя ///// By MyStyle
$text = 'Не хватает корма';
$_SESSION['msg'] = $text;
}
header("Location: ?linkanimals");
exit;
}
$user['set'] = 10;
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `mystyle_amimals_user` 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_amimals_user` WHERE `user` = '".$user['id']."' LIMIT $start, $user[set]");
while($post=mysql_fetch_array($q))
{
if(!$post['img_animals']){
echo '<li><div style="border: 1px solid #99856a; margin: 4px 0; border-radius: 4px; background-color: #705e3e">';
echo '<img class="portrait pt6 pl6 pr6 center kartinki_div" width="60" height="60" src="images/zombi/C_4.png" alt="" />';
echo '<a href="?bayanimals='.$post['id'].'" class="btnp">Купить животное</a>';
echo '</li></div><div style="clear:both"></div>';
}else{
echo '<li><a class="fr btnp" href="?animalmoney='.$post['id'].'">Продать животное</a><div style="border: 1px solid #99856a; margin: 4px 0; border-radius: 4px; background-color: #87735c">';
echo '<img class="portrait pt6 pl6 pr6 center kartinki_div" width="60" height="60" src="images/pet/'.$post['img_animals'].'" alt="" />';
echo '<a class="btnp">'.$post['name'].'</a>';
$tere = $post['time'];
if($tere < time()){
echo ' <a href="?linkanimals&id='.$post['id'].'" class="btnp" title="Покормить"><img width="24" height="24" src="images/pet/'.$post['img'].'.png" alt="" /></a>';
}
if($post['time'] < time()){
echo ' <a class="btnp"><img width="24" height="24" src="images/pet/'.$post['img_corm'].'.png" alt="" /> - '.$post['col'].'</a></li></div>';
}else{
echo '</li></div>До сбора: '.time_left($post['time']-$time).'<br />';
}
if($tere < time()){
echo 'Пора собрать.<br />';
}
if($post['time'] < time()){
echo 'Пора кормить.<br />';
}
echo '<div style="clear:both"></div>';
}/////img amimals
}
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `mystyle_amimals_user` WHERE `user` = '".$user['id']."'"),0)<20)echo "<li style="border: 1px solid #d9c6b4; margin: 4px 0; border-radius: 4px; background-color: #87735c"><img class="portrait pt6 pl6 pr6 center kartinki_div" width="60" height="60" src="images/zombi/C_4.png" alt="" /><div><span class='title'>Новый загон</span></div><div><img width='16' height='16' src='images/zombi/cash.png' alt='o'> <a href='?newgardenanimals'><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_amimals_user` WHERE `user` = '".$user['id']."'"),0))."</span> зомби баксов</span></div><div style='clear:both'></div></li>";
if ($k_page>1)str("?linkAnimals&",$k_page,$page);
echo '<span class="beauty fr"><a class="btnp">У вас корма:</a></span><div class="feedbackPanel"><div><table class="center pt6 pb6" style="margin:0 auto; width: 80%;"><tr class="whiteBoldLink textshadow">
<td><a href="?linkusersklad" title="Взять корма"><img width="25" height="25" src="images/pet/s_bean.png" alt="" /></a></td>
<td><a href="?mscorm" title="Взять корма"><img width="25" height="25" src="images/pet/s_grass.png" alt="" /></a></td>
</tr>';
echo '<tr class="blueSecColor textshadow">
<td><a href="?linkusersklad" title="Взять корма">'.$user['corm1'].'</a></td>
<td><a href="?mscorm" title="Взять корма">'.$user['corm2'].'</a></td>
</tr>';
echo '</table></div></div></div>';
/////////////////////////
/*
Author MyStyle ZomBi.Biz
12/05/2013
*/
/////////////////////////
?>