<?php

define('_IN_JOHNCMS', 1);

$headmod = '';
require_once("../incfiles/core.php");
$textl = '' . $copyright . ' - Мои сообщения';
require_once("../incfiles/head.php");

echo '<div class="phdr"><b>Мои сообщения</b></div><div>';
        $count_mail = mysql_result(mysql_query("SELECT COUNT(*) FROM `privat` WHERE `user` = '$login' AND `type` = 'in'"), 0);
        $count_newmail = mysql_result(mysql_query("SELECT COUNT(*) FROM `privat` WHERE `user` = '" . $login . "' AND `type` = 'in' AND `chit` = 'no'"), 0);
        echo '<img src="images/act3.gif" width="7" height="10" alt="-" /> <a href="str/pradd.php?act=in">Входящие</a>&nbsp;(' . $count_mail . ($count_newmail ? '&nbsp;/&nbsp;<span class="red"><a href="str/pradd.php?act=in&amp;new">+' . $count_newmail . '</a></span>' : '') . ')<br />';
        $count_sentmail = mysql_result(mysql_query("SELECT COUNT(*) FROM `privat` WHERE `author` = '$login' AND `type` = 'out'"), 0);
        $count_sentunread = mysql_result(mysql_query("SELECT COUNT(*) FROM `privat` WHERE `author` = '$login' AND `type` = 'out' AND `chit` = 'no'"), 0);
        echo '<img src="images/act3.gif" width="7" height="10" alt="-" /> <a href="str/pradd.php?act=out">Отправленные</a>&nbsp;(' . $count_sentmail . ($count_sentunread ? '&nbsp;/&nbsp;<span class="red">' . $count_sentunread . '</span>' : '') . ')<br />';
        $count_files = mysql_result(mysql_query("SELECT COUNT(*) FROM `privat` WHERE `user` = '$login' AND `type` = 'in' AND `attach` != ''"), 0);
        //echo '<li><a href="str/pradd.php?act=files">Файлы</a>&nbsp;(' . $count_files . ')</li>';
        if (!$ban['1'] && !$ban['3'])
            echo '<img src="images/act3.gif" width="7" height="10" alt="-" /> <a href="str/pradd.php?act=write">Написать</a><br />';
        $count_contacts = mysql_result(mysql_query("SELECT COUNT(*) FROM `privat` WHERE `me` = '$login' AND `cont` != ''"), 0);
        echo '<img src="images/act3.gif" width="7" height="10" alt="-" /> <a href="str/cont.php">Контакты</a>&nbsp;(' . $count_contacts . ')<br />';
        $count_ignor = mysql_result(mysql_query("SELECT COUNT(*) FROM `privat` WHERE `me` = '$login' AND `ignor` != ''"), 0);
        echo '<img src="images/act3.gif" width="7" height="10" alt="-" /> <a href="str/ignor.php">Игнор</a>&nbsp;(' . $count_ignor . ')<br />';
        echo '</div>';

require_once("../incfiles/end.php");

?>