Файл: bashni/ok.php
Строк: 24
<?
include_once '../core/system.php';
echo only_reg();
if (isset($_GET['id']) && mysql_result(mysql_query("SELECT COUNT(*) FROM `bashni` WHERE `id` = '".intval($_GET['id'])."'"),0) == true){
$bashnay = mysql_fetch_assoc(mysql_query("SELECT * FROM `bashni` WHERE `id` = '".intval($_GET['id'])."'"));
}else{
$_SESSION['err'] = "Нет такой башни!";
header('Location: index.php');
exit();
}
if($bashnay[health] < 1){
mysql_query("update `bashni` set `id_user` = '$user[id]', `sila` = '$user[sila]', `max_health` = '$user[max_health]', `health` = '$user[max_health]', `lovk` = '$user[lovk]', `zashit` = '$user[zashit]' WHERE `id` = '$bashnay[id]'");
header("Location: bashnya.php?id=$bashnay[id]");
$_SESSION['light'] = "<h2 class='dgreen' style='font-weight:bold;'> $bashnay[name]</h2><div class='separ'></div>Вы завладели башней!";
}else{
header("Location: bashnya.php?id=$bashnay[id]");
$_SESSION['err'] = "Башня еще не разрушена!";
exit();
}
?>