<?
require_once '../core/system.php';
echo admin();
$header = 'Проверка почты';
require_once H.'core/head.php';
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'])."'"));
}
if($user['prava']==7  and !empty($_GET['id'])){
		if($_GET['ank']==1 AND $user['id'] !=1){
		echo '<div id="error">Почти получилось...</div>';
require_once H.'core/foot.php';
		exit;
		}

	echo '<div class="name">Почта <a href="/user/'.$ank['id'].'/">'.$ank['nick'].'</a></div>';
	$total = mysql_result(mysql_query("SELECT COUNT(id) FROM `mail` WHERE `id_user` = '$ank[id]' OR `id_kont` = '$ank[id]'"),0);
		if($total == 0){
		echo '<div class="row">Пусто :)</div>';
require_once H.'core/foot.php';
		exit;
		}
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `mail` WHERE  `id_kont` = '$ank[id]' OR `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 COUNT(*) FROM `mail` WHERE  `id_kont` = '$ank[id]' OR `id_user` = '$ank[id]'  ORDER BY time DESC LIMIT $start, $set[p_str]");
while($post= mysql_fetch_assoc($q)) {
			$ank2 = mysql_fetch_assoc(mysql_query("SELECT * FROM `user` WHERE `id` = $post[id_user]"));
if($ank2[prava] == 5 ){
$color = 'Admin';
}
if($ank2[prava] == 7 ){
$color = 'red';
}
if($ank2[prava] == 4 ){
$color = 'Moder';
}
if($ank2[prava] == 3 ){
$color = 'orange';
}
if($ank2[prava] == 0 ){
$color = '';
}
echo "<div class='player'>";
if ($ank2['storona'] == '0') {?><img src="/images/icon/0.png" height="11" alt="a"/> <?php }
	    if ($ank2['storona'] == '1') {?><img src="/images/icon/1.png" height="11" alt="d"/> <?php }
echo online($ank2[id]);
echo " <a href='/user/$ank2[id]/'>$post[nick]</a>";
if($post[read] == 1){
echo "<span class='float-right dgreen'>".vremja($post[time])."</span>";
}else{
echo "<span class='float-right grey'>".vremja($post[time])."</span>";
}
echo ':<br><span class="'.$color.'">'.smiles($post['msg']).'</span><br>';
echo "</div>";
echo "<div class='dot-line'></div>";
}
if ($k_page>1)str('mail.php?id=' . intval($_GET['id']) . '&amp;',$k_page,$page); // Вывод страниц
		if($total > $set['str'])
	
	
require_once H.'core/foot.php';
		exit;
		}
require_once H.'core/foot.php';
?>