<?
require_once '../core/system.php';
echo ban();
if (isset($_GET['id1'])) {
$id1 = check($_GET[id1]);
}
if (isset($_GET['id2'])) {
$id2 = check($_GET[id2]);
}
require_once '../core/head.php';
echo "<div class='player menuList'>";
echo "<li><a href='/smiles.php'><img src='/images/icon/arrow.png'>C&#1087;&#1080;&#1089;&#1086;&#1082; &#1089;&#1084;&#1072;&#1081;&#1083;&#1086;&#1074;</a></li>";
echo "<li><a href='?id=$ank[id]'><img src='/images/icon/arrow.png'>&#1054;&#1073;&#1085;&#1086;&#1074;&#1080;&#1090;&#1100;</a></li>";
echo "</div>";
echo "<div class='mini-line'></div>";
echo "<div class='block_zero center'><form action='?id=$ank[id]' method='post'><div>&#1057;&#1086;&#1086;&#1073;&#1097;&#1077;&#1085;&#1080;&#1077;:<br/><textarea name='msg' class = 'text large' rows='4' cols='55'></textarea><br/><div class='center'><span class='btn'><span class='end'><input class='label' type='submit' value='&#1054;&#1090;&#1087;&#1088;&#1072;&#1074;&#1080;&#1090;&#1100;'>&#1054;&#1090;&#1087;&#1088;&#1072;&#1074;&#1080;&#1090;&#1100;</span></span></div><input type='hidden' name='r' value='68863272'/></div></form></div>";
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `mail` WHERE `unlink` != '$user[id]' AND `id_user` = '$id1' AND `id_kont` = '$id2' OR `id_user` = '$id2' AND `id_kont` = '$id1' AND `unlink` != '$user[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 `mail` WHERE `unlink` != '$user[id]' AND `id_user` = '$id1' AND `id_kont` = '$id2' OR `id_user` = '$id2' AND `id_kont` = '$id1' AND `unlink` != '$user[id]' ORDER BY id DESC LIMIT $start, $set[p_str]");
echo "<div class='mini-line'></div>";
while($post = mysql_fetch_assoc($q)) {
//mysql_query("UPDATE `mail` SET `read` = '0' WHERE `id` = '$post[id]' AND `id_user` = '$ank[id]' LIMIT 1");
$ank2 = mysql_fetch_assoc(mysql_query("SELECT * FROM `user` WHERE `id` = $post[id_user] LIMIT 1"));
if($ank2[prava] == 5 ){
$color = 'Admin';
}
if($ank2[prava] == 7 ){
$color = 'red';
}
if($ank2[prava] == 4 ){
$color = 'Moder';
}
if($ank2[prava] == 0 ){
$color = '';
}
echo "<div class='player'>";
if ($ank2['storona'] == '0') {echo '<img src="/images/icon/0.png" height="11" alt="a"/> ';}
    if ($ank2['storona'] == '1') {echo '<img src="/images/icon/1.png" height="11" alt="d"/> ';}
echo online($ank2[id]);
echo " <a href='/user/$ank2[id]/'>$ank2[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('read.php?id1='.$id1.'&id2='.$id2.'&amp;',$k_page,$page); // &#1042;&#1099;&#1074;&#1086;&#1076; &#1089;&#1090;&#1088;&#1072;&#1085;&#1080;&#1094;
echo "<div class='mini-line'></div>";
echo "<div class='player menuList'>";
echo "<li><a href='posters'><img src='/images/icon/arrow.png'>&#1050;&#1086;&#1085;&#1090;&#1072;&#1082;&#1090;&#1099;</a></li>";
echo "</div>";
echo "</div>";
require_once '../core/foot.php';

?>