Файл: 3/astro_sn.php
Строк: 27
<?php
require_once ('system/func.php');
auth(); // Закроем от гостей
switch($_GET[mod]){
default:
$req = $db->query("SELECT * FROM `asto_us` WHERE `user_id` = ".$user['id']." and `status`='on' 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;
}
if($avto==0){
header ('Location: astrals.php');
exit;
}
$mag = $req->fetch_assoc();
$numin=$user['str']-$mag['ataka'];
$numin2=$user['def']-$mag['zahita'];
$hp=$user['max_health']-$mag['hp'];
$mp=$user['max_energy']-$mag['mp'];
$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`= 'off' WHERE `user_id` = ".$user['id']." and `tip`='".num($_GET['tip'])."' and `id`='".num($_GET['id'])."'");
header ('Location: astrals.php'); exit;
}
?>