<?
include_once '../core/system.php';
echo only_reg();
if (isset($_GET['id']) && mysql_result(mysql_query("SELECT COUNT(*) FROM `zamok` WHERE `id` = '".intval($_GET['id'])."'"),0) == true){
$zamok = mysql_fetch_assoc(mysql_query("SELECT * FROM `zamok` WHERE `id`  = '".intval($_GET['id'])."'"));
}else{
$_SESSION['err'] = "Нет такого замка!";
header('Location: index.php');
exit();
}
$ank = mysql_fetch_assoc(mysql_query("SELECT * FROM `user` WHERE `id`  = '".$zamok[id_user]."'"));
$header = $zamok[name];
include_once '../core/head.php';
echo "<div class='player center'><img src='/zamok/zamok.png'></div>";
echo "<div class='dot-line'></div>";
echo "<div class='player'>Владелец: ";
echo "<img src='/images/icon/user.png' alt=''/> <a href='/user/?id=$ank[id]'>$ank[nick]</a> <img src='/images/icon/level.png'> $ank[level]</div>";
echo "<div class='dot-line'></div>";
echo "<div class='player'>Параметры крепости: <img src='/images/icon/str.png' alt='str'/> $zamok[param] <img src='/images/icon/level.png'> $zamok[level]</div>";
echo "<div class='dot-line'></div>";
echo "<div class='player'>Стоят в защите:</br><img src='/images/icon/user.png'> Титаны: $zamok[titan1] </br><img src='/images/icon/user.png'> Циклопы: $zamok[titan2] </br><img src='/images/icon/user.png'> Колдуны: $zamok[titan3]</div>";
echo "<div class='dot-line'></div>";
echo "<div class='player center'>";
if($zamok[param] < 1){
if($user[id] != $ank[id])echo "<a class='btn' href='ok.php?id=$zamok[id]'><span class='end'><span class='label'>Завладеть</span></span></a>";
}else{
if($user[id] != $ank[id])echo "<a class='btn' href='ataka.php?id=$zamok[id]'><span class='end'><span class='label'>Атакoвать</span></span></a>";
}
if($user[id] == $ank[id])echo "<a class='btn' href='level.php?id=$zamok[id]'><span class='end'><span class='label'><span class='grey'>Цена: <img src='/images/icon/gold.png'> 50</span> Повысить уровень <span class='grey'><img src='/images/icon/level.png'> +1</span></span></span></a>";
if($user[id] == $ank[id])echo "<a class='btn' href='zashita.php?id=$zamok[id]'><span class='end'><span class='label'>Наим воинов</span></span></a>";
if($user[id] == $ank[id])echo "<a class='btn' href='remont.php?id=$zamok[id]'><span class='end'><span class='label'><span class='grey'>Цена: <img src='/images/icon/kamni.png'> 1000</span> Ремонт</span></span></a>";
echo "</div>";
echo "<div class='mini-line'></div>";
echo "<div class='player menuList'>";
echo "<li><a href='/user/zamok.php?id=$user[id]'><img src='/images/icon/tournament.png'>Мои Замки</a></li>";
echo "<li><a href='/zamok/'><img src='/images/icon/tournament.png'>Замки</a></li>";
echo "</div>";
include_once '../core/foot.php';
?>