Файл: test.zfarm.mobi/Animals/bayanimals.php
Строк: 73
<?php
/////////////////////////
/*
Author MyStyle ZomBi.Biz
12/05/2013
*/
/////////////////////////
what(0, 'animal');
if(isset($_GET['bay']) && num($_GET['bay'])!=NULL && isset($_GET['id']) && num($_GET['id'])!=NULL && mysql_result(mysql_query("SELECT COUNT(*) FROM `mystyle_animals` WHERE `id` = '".num($_GET['bay'])."' AND `level` <= '".$user['level']."' LIMIT 1"),0) && mysql_result(mysql_query("SELECT COUNT(*) FROM `mystyle_amimals_user` WHERE `id` = '".num($_GET['id'])."' AND `user` = '".$user['id']."' LIMIT 1"),0)!=0){
$fer = mysql_fetch_array(mysql_query("SELECT * FROM `mystyle_animals` WHERE `id` = '".num($_GET['bay'])."' AND `level` <= '".$user['level']."'"));
$les = mysql_fetch_array(mysql_query("SELECT * FROM `mystyle_amimals_user` WHERE `id` = '".num($_GET['id'])."'"));
$need=$fer['money'];
if($user['money']>=$need){
update_minus('money',$need);
$time_got = $time+$fer['time'];
update_an_user('id',num($_GET['id']),'name',$fer['name'],'time',$time_got,'exp',$fer['exp'],'money',$fer['money'],'img_animals',$fer['img_animals'],'img_corm',$fer['img_corm'],'img',$fer['img'],'col',$fer['col']);
$text = 'Вы купили: '.$fer['name'];
$_SESSION['msg'] = $text;
header("Location: ?linkanimals");
exit;
}else{
err_money($need-$user['money']);
}
}elseif(isset($_GET['bayanimals']) && num($_GET['bayanimals'])!=NULL && mysql_result(mysql_query("SELECT COUNT(*) FROM `mystyle_amimals_user` WHERE `user` = '".$user['id']."' AND `id` = '".num($_GET['bayanimals'])."' AND `img_animals` = '' LIMIT 1"),0)!=0){
$farm = mysql_fetch_array(mysql_query("SELECT * FROM `mystyle_amimals_user` WHERE `id` = '".num($_GET['bayanimals'])."'"));
$user['set'] = 10;
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `mystyle_animals`"),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_animals` ORDER BY `level` DESC LIMIT $start, $user[set]");
while($post=mysql_fetch_array($q))
{
echo '<li><div style="border: 1px solid #d9c6b4; margin: 4px 0; border-radius: 4px; background-color: #8a694c">';
echo '<img width="70" height="70" class="portrait pt6 pl6 pr6 center" src="images/pet/'.$post['img_animals'].'" alt="" />';
if($user['level']>=$post['level']){
echo '<a href="?bayanimals&bay='.$post['id'].'&id='.num($_GET['bayanimals']).'" class="btnp level">Купить животное</a>';
}else{
echo '<a class="btnp">Купить животное</a>';
}
echo ' <b class="btnp"><img width="24" height="24" src="images/zombi/level/'.$post['level'].'.png" alt="уровень" title="уровень"/></b> Кормить: <b class="btnp"><img width="24" height="24" src="images/pet/'.$post['img_corm'].'.png" alt="" title=""/></b> Дает: <b class="btnp"><img width="24" height="24" src="images/pet/'.$post['img'].'.png" alt="" title=""/></b>';
echo '</li></div>'.$post['name'].'<br />Цена покупки: <img width="16" height="16" src="images/zombi/coins.png" alt=""/> <span class="money nobr textshadow">'.$post['money'].'</span><br />Опыт за кормление: <span class="money nobr textshadow">'.$post['exp'].'</span><div style="clear:both"></div>';
} ///// While
if ($k_page>1)str("?bayanimals=".num($_GET['bayanimals'])."&",$k_page,$page); // Вывод страниц
}else{ ///// If
header("Location: ./");
exit;
}
/////////////////////////
/*
Author MyStyle ZomBi.Biz
12/05/2013
*/
/////////////////////////
?>