Файл: 3/astro_ok.php
Строк: 41
<?php
require_once ('system/func.php');
$title = 'Астралы';
require_once ('system/header.php');
auth(); // Закроем от гостей
echo'<div class="lent mlra w80">
<div class="bl-ttl"><div class="te"><div class="ttl">
'.$title.'
</div></div></div>';
$req = $db->query("SELECT * FROM `asto_us` WHERE `user_id` = ".$user['id']." and `status`='off' and `id`='".num($_GET['id'])."' and `tip`='".num($_GET['tip'])."'");
$avto=$req->num_rows;
if($_GET['tip']!=2 && $_GET['tip']!=3 && $_GET['tip']!=4 && $_GET['tip']!=5){
header ('Location: astrals.php');
exit;
}
$req1 = $db->query("SELECT * FROM `asto_us` WHERE `user_id` = ".$user['id']." and `tip`='".num($_GET['tip'])."' and `status`='on'");
$avto1=$req1->num_rows;
if($avto1>=1){
echo'<div class="block">'.ico('icons','city.png').' Нельзя одевать астралы одного типа!</div>';
echo'<a href="astrals.php" class="link"><img src="/images/icons/astro.png" alt=""/> Астралы</a></div>';
require_once ('system/footer.php');
exit;
}
if($avto==0){
header ('Location: astrals.php');
exit;
}
$mag = $req->fetch_assoc();
$numin=$mag['ataka']+$user['str'];
$numin2=$mag['zahita']+$user['def'];
$hp=$mag['hp']+$user['max_health'];
$mp=$mag['mp']+$user['max_energy'];
$db->query("UPDATE `users` SET `str`= ".$numin.",`def`= ".$numin2.",`max_health`= ".$hp.",`max_energy`= ".$mp." WHERE `id`=".$user['id']."");
$db->query("UPDATE `asto_us` SET `status`= 'on' WHERE `user_id` = ".$user['id']." and `tip`='".num($_GET['tip'])."' and `id`='".num($_GET['id'])."'");
header ('Location: /astrals.php?');
exit();
echo'</div>';
require_once ('system/footer.php');
?>