File size: 4.42Kb
<?
if (!isset($_GET['id']))
{
echo "<div class=\"h\">Исходящие</div><br />\n";
$k_mess=0;
$q = mysql_query("SELECT * FROM `$mysql[pref]mail` WHERE `id_out_user` = '$user[id]';");
while ($messagess = mysql_fetch_array($q))
{
$mess[$k_mess]=$messagess;
$k_mess++;
}
$k_p_str=$user['forum_k_p_s'];
if (isset ($mess) && count($mess)!="0")
{
$v_pages_okr=count($mess)/$k_p_str%100;
$v_pages_tochn=count($mess)/$k_p_str;
if ($v_pages_okr==$v_pages_tochn)
{
$k_page=$v_pages_okr;
}
else
{
$k_page=$v_pages_okr+1;
}
//echo "Количество страниц: $k_page<br />";
//echo "Количество сообщений: ".count($post)."<br /><br />";
$page=1;
if (isset($_GET['page']) && $_GET['page']!='')
{
if ($_GET['page']=='end')
{
$page=$k_page;
}
else
{
$page=intval($_GET['page']);
}
}
$page=intval($page);
if ($k_page<$page){$page=$k_page;}
if (0>$page){$page=1;}
usort ($mess, "stime");
$mess=array_reverse($mess);
for ($i=$k_p_str*$page-$k_p_str;$i<$k_mess && $i<$k_p_str*$page;$i++)
{
$timep=vremja($mess[$i]['time']+$timesdvig);
echo "<div class=\"mess\">\n";
$mess_id=$mess[$i]['id'];
if ($mess[$i]['read']==0)
{
echo "<img src=\"SYSTEM/themes/$them/img/mail0.gif\" alt=\"\" /> ";
}
else
{
echo "<img src=\"SYSTEM/themes/$them/img/mail1.gif\" alt=\"\" /> ";
}
$id_ank=$mess[$i]['id_in_user'];
$q = mysql_query("SELECT * FROM `$mysql[pref]users` WHERE `id` = '$id_ank';");
$ank = mysql_fetch_array($q, 1);
echo " <a href=\"mail.php?act=out&id=$mess_id\"><span style=\"color:$color[mess_nick]\"><b>$ank[nickname]</b></span></a> ";
echo "<span style=\"color:$color[post_time]\">[$timep]</span>";
echo "</div>\n";
}
echo "<br />\n<div class=\"str\">";
echo "Стр: [";
if ($page!=1)
{
echo "<a href=\"mail.php?act=out&page=1\">1</a>";
}
else
{
echo "<b>1</b>";
}
$in=-3;
$out=3;
for ($ot=$in; $ot<=$out; $ot++)
{
$t_str=$page+$ot;
if ($t_str>1 && $t_str<$k_page)
{
if ($in==$ot && $t_str>2)
{
echo " ..";
}
if ($ot!=0)
{
echo " <a href=\"mail.php?act=out&page=$t_str\">$t_str</a>";
}
else
{
echo " <b>$t_str</b>";
}
if ($ot==$out && $t_str<$k_page-1)
{
echo " ..";
}
}
}
if ($page!=$k_page)
{
echo " <a href=\"mail.php?act=out&page=end\">$k_page</a>";
}
elseif ($k_page>1)
{
echo " <b>$k_page</b>";
}
echo "]";
echo "</div>\n";
}
else
{
echo "Нет сообщений<br />\n";
}
echo "<hr />\n";
echo "<a href=\"mail.php\"><< Почта</a><br />\n";
echo "<a href=\"index.php\"><< На главную</a>\n";
foot();
}
$id_mess=intval($_GET['id']);
echo "<div class=\"h\">Исходящее сообщение</div><br />\n";
$q = mysql_query("SELECT COUNT(*) FROM `$mysql[pref]mail` WHERE `id_out_user` = '$user[id]' AND `id` = '$id_mess';");
if(mysql_result($q, 0)==0){header ("Location: mail.php?".SID."&act=out");}
$q = mysql_query("SELECT * FROM `$mysql[pref]mail` WHERE `id_out_user` = '$user[id]' AND `id` = '$id_mess';");
$mess = mysql_fetch_array($q, 1);
echo "<div class=\"mess\">\n";
if ($mess['read'])
echo "<img src=\"SYSTEM/themes/$them/img/mail1.gif\" alt=\"\" /> ";
else
echo "<img src=\"SYSTEM/themes/$them/img/mail0.gif\" alt=\"\" /> ";
$q = mysql_query("SELECT * FROM `$mysql[pref]users` WHERE `id` = '$mess[id_in_user]';");
$ank = mysql_fetch_array($q, 1);
echo " <a href=\"info.php?id=$mess[id_in_user]\"><span style=\"color:$color[user]\"><b>$ank[nickname]</b></span></a>";
$timep=vremja($mess['time']+$timesdvig);
echo "<br />\n";
echo "<span style=\"color:$color[post_time]\">[$timep]</span>";
echo "<br />\n";
echo "<span style=\"color:$color[post]\">".smiles(links(mess($mess['text'])))."</span><br />";
echo "<hr />\n";
if ($mess['read']) echo "Прочитано";
else
{
echo "Не прочитано<br />\n";
echo "<a href=\"mail.php?act=del_out&mess=$mess[id]\">Отменить отправку</a><br />\n";
}
echo "</div>\n";
$q = mysql_query("SELECT COUNT(id) FROM `$mysql[pref]kont` WHERE `id_user` = '$user[id]' AND `id_kont` = '$mess[id_in_user]';");
if (mysql_result($q, 0)==0)
{
echo "<a href=\"mail.php?act=kont&id=$mess[id_out_user]\">В контакты</a><br />\n";
}
echo "<a href=\"mail.php?act=out\"><< Исходящие</a><br />\n";
echo "<a href=\"mail.php\"><< Почта</a><br />\n";
echo "<a href=\"index.php\"><< На главную</a>\n";
foot();
?>