<?
include_once '../core/system.php';
echo only_reg();
if (isset($_GET['id']) && mysql_result(mysql_query("SELECT COUNT(*) FROM `user` WHERE `id` = '".intval($_GET['id'])."'"),0) == true){
$ank = mysql_fetch_assoc(mysql_query("SELECT * FROM `user` WHERE `id`  = '".intval($_GET['id'])."'"));
}else{
$_SESSION['err'] = "Игрок не найден";
header('Location: /');
exit();
}
$header = 'Башни '.$ank[nick];
include_once '../core/head.php';
$k_post = mysql_result(mysql_query("SELECT COUNT(*)  FROM `bashni` WHERE `id_user` = '$ank[id]'"),0);
$k_page = k_page($k_post,$set['p_str']);
$page = page($k_page);
$start = $set['p_str']*$page-$set['p_str'];
$q = mysql_query("SELECT * FROM `bashni` WHERE `id_user` = '$ank[id]' ORDER BY `health` DESC LIMIT $start, $set[p_str]");
echo "<div class='player'>";
if($k_post == 0)echo "<span class='grey'>Нет башен</span>";
while($post = mysql_fetch_assoc($q)) {
echo "<img src='/images/icon/sumstat.png'> <a href='/bashni/bashnya.php?id=$post[id]'>$post[name]</a>, $post[health]</a><br>";
}
echo "</div>";
echo "<div class='dot-line'></div>";
if ($k_page>1)str("bashni.php?id=$ank[id]&",$k_page,$page); // Вывод страниц
echo "<div class='mini-line'></div>";
echo "<div class='player menuList'>";
echo "<li><a href='/user/$ank[id]/'><img src='/images/icon/arrow.png'>Вернуться к игроку</a></li>";
echo "</div>";
include_once '../core/foot.php';
?>