<?php

define('H', $_SERVER['DOCUMENT_ROOT'].'/');
foreach(array('start', 'compress', 'sess', 'home', 'settings', 'db_connect', 'ipua', 'fnc', 'user') as $inc) 
require H.'sys/inc/'.$inc.'.php';

if (isset($user))$ank['id']=$user['id'];
if (isset($_GET['id']))$ank['id']=intval($_GET['id']);
$ank=get_user($ank['id']);
if(!$ank){header("Location: /index.php?".SID);exit;}

$set['title'] = 'История ников '.$ank['nick'];
require H.'sys/inc/thead.php';
title();
aut();



$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `history_nick` WHERE `user_id` = '$ank[id]'"),0);
$k_page = k_page($k_post,$set['p_str']);
$page = page($k_page);
$start = $set['p_str']*$page-$set['p_str'];
if ($k_post == 0) echo '<div class="mess">Пользователь не изменял свой ник</div>';



$sql = mysql_query("SELECT * FROM `history_nick` WHERE `user_id` = '$ank[id]' ORDER BY `id` DESC LIMIT $start,$set[p_str]");
while($a = mysql_fetch_assoc($sql)) {
echo '<div class="nav1"><b>'.$a['nick_last'].'</b> -> <b>'.$a['nick_new'].'</b><br/>Изменил: '.user::nick($a['who']).' ('.vremja($a['time']).')</div>';
}
if ($k_page>1)str('?',$k_page,$page);

echo "<div class='foot'>\n";
echo "<img src='/style/icons/str2.gif' alt='*'> <a href='/id".$ank['id']."'>".$ank['nick']."</a> | <b>История ников</b><br />\n";
echo "</div>\n";

require_once H.'sys/inc/tfoot.php';
?>