Файл: DARK WARS/dark_war/clans/raid/new_attack.php
Строк: 43
<?php
include_once '../../start.php';
$doc = new document();
$doc->title('Атака');
if(!$_COOKIE["clan"]){
header("Location: /dark_war/clans/");
}
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `dark_war_clan_creep` WHERE `id_clan` = '".$_COOKIE["clan"]."'"), 0)) {
$ar = mysql_fetch_assoc(mysql_query("SELECT id_creep FROM `dark_war_clan_creep` WHERE `id_clan` = '".$_COOKIE["clan"]."' LIMIT 1"));
setcookie ("clan_monster_id", $ar['id_creep']);
$_SESSION['clan_monster'] = TRUE;
$_SESSION['clan_monster_id'] = $ar['id_creep'];
header("Location: /dark_war/clans/raid/attack.php");
exit();
}
if (!isset($_GET['id']) || !is_numeric($_GET['id'])) {
header("Location: /dark_war/clans/raid/view.php");
exit();
}
if($_GET['id']){
$id = (int)$_GET['id'];}
elseif($_SESSION['clan_monster_id']){
header("Location: /dark_war/clans/raid/attack.php");
exit();
}
$ar = mysql_fetch_assoc(mysql_query("SELECT * FROM `dark_war_clan_monsters` WHERE id = '$id' LIMIT 1"));
if (!isset($ar['id'])) {
$doc->err('Ошибка, нет такого монстра');
exit();
}
if ($ar['level'] > ($player->level + 3)) {
$doc->err('Ваш уровень слишком мал');
exit();
}
mysql_query("INSERT INTO `dark_war_clan_creep` (`id_clan`, `id_creep`, `hp`, `mp`, `dmg`, `armor`, `armorp`, `magicr`, `magicp`)
VALUES('".$_COOKIE["clan"]."', '$ar[id]', '$ar[hp]', '$ar[mp]', '$ar[dmg]', '$ar[armor]', '$ar[armorp]',
'$ar[magicr]', '$ar[magicp]')");
setcookie ("clan_monster_id", $ar['id']);
$_SESSION['clan_monster'] = TRUE;
$_SESSION['clan_monster_id'] = $ar['id'];
header("Location: /dark_war/clans/raid/attack.php");
exit();
?>