<?

include_once "SYSTEM/include/functions.php";

include_once "SYSTEM/include/mysql.php";

include_once "SYSTEM/include/param.php";

include_once "SYSTEM/include/ban.php";

include_once "SYSTEM/include/sess.php";

include_once "SYSTEM/include/ban_2.php";

include_once "SYSTEM/include/theme.php";

$title='Почта';

$mesto='Почта';

head();



if (!isset($user))

{

header ("Location: index.php");

exit;

}



if (isset($_GET['act']))

{

if ($_GET['act']=='crt')

{

include "SYSTEM/mail/create.php";



echo "<a href=\"index.php\">&lt;&lt; На главную</a>\n";

foot();



}

if ($_GET['act']=='in')

{

include "SYSTEM/mail/input.php";

echo "<a href=\"index.php\">&lt;&lt; На главную</a>\n";



foot();

}

if ($_GET['act']=='kont')

{

include "SYSTEM/mail/kont.php";



echo "<a href=\"index.php\">&lt;&lt; На главную</a>\n";

foot();



}

if ($_GET['act']=='konts')

{

include "SYSTEM/mail/konts.php";



echo "<a href=\"index.php\">&lt;&lt; На главную</a>\n";

foot();



}

if ($_GET['act']=='out')

{

include "SYSTEM/mail/output.php";



echo "<a href=\"index.php\">&lt;&lt; На главную</a>\n";

foot();



}

if ($_GET['act']=='del_in')

{

include "SYSTEM/mail/delete_in.php";



echo "<a href=\"index.php\">&lt;&lt; На главную</a>\n";

foot();



}

if ($_GET['act']=='del_out')

{

include "SYSTEM/mail/delete_out.php";



echo "<a href=\"index.php\">&lt;&lt; На главную</a>\n";

foot();



}

}







echo "<div class=\"h\">Почта $user[nickname]</div>";



if (isset($_GET['msg']))

{

$msg=$_GET['msg'];

echo "<span style=\"color:$color[msg]\"><b>";

if ($msg=='send_ok'){echo "Сообщение отправлено";}

if ($msg=='kont_add'){echo "Контакт добавлен";}

if ($msg=='kont_iss'){echo "Контакт уже существует в вашем списке";}

if ($msg=='kont_del'){echo "Контакт удален";}

if ($msg=='mess_del'){echo "Сообщение удалено";}

if ($msg=='mess_cancel'){echo "Отправка отменена";}

echo "</b></span>\n";

}

echo "<hr />\n";





$q = mysql_query("SELECT COUNT(id) FROM `$mysql[pref]mail` WHERE `id_in_user` = '$user[id]' AND `show_to_polych` = '1';");

$mail_in = mysql_result($q, 0);



$q = mysql_query("SELECT COUNT(id) FROM `$mysql[pref]mail` WHERE `id_in_user` = '$user[id]' AND `show_to_polych` = '1' AND `read` = '0';");

$mail_in_new = mysql_result($q, 0);



if ($mail_in_new==0){$mail_in_new='';}else{$mail_in_new='/<b>+'.$mail_in_new.'</b>';}

$q = mysql_query("SELECT COUNT(id) FROM `$mysql[pref]kont` WHERE `id_user` = '$user[id]';");

$k_kont = mysql_result($q, 0);







echo "<div class=\"menu\">\n";

if ($k_kont>0){echo "<img src=\"SYSTEM/themes/$them/img/menu.gif\" alt=\"\" /> ";

echo "<a href=\"mail.php?act=crt\">Написать</a><br />\n";}

echo "<img src=\"SYSTEM/themes/$them/img/menu.gif\" alt=\"\" /> ";

echo "<a href=\"mail.php?act=in\">Входящие</a> [$mail_in$mail_in_new]<br />\n";





$q = mysql_query("SELECT COUNT(id) FROM `$mysql[pref]mail` WHERE `id_out_user` = '$user[id]' AND `show_to_otpr` = '1';");

$mail_out = mysql_result($q, 0);



$q = mysql_query("SELECT COUNT(id) FROM `$mysql[pref]mail` WHERE `id_out_user` = '$user[id]' AND `show_to_otpr` = '1' AND `read` = '0';");

$mail_out_new = mysql_result($q, 0);



if ($mail_out_new==0){$mail_out_new='';}else{$mail_out_new='/<b>+'.$mail_out_new.'</b>';}



echo "<img src=\"SYSTEM/themes/$them/img/menu.gif\" alt=\"\" /> ";

echo "<a href=\"mail.php?act=out\">Исходящие</a> [$mail_out$mail_out_new]<br />\n";

if ($k_kont>0)

{

echo "<img src=\"SYSTEM/themes/$them/img/menu.gif\" alt=\"\" /> ";

echo "<a href=\"mail.php?act=konts\">Контакты</a> [$k_kont]<br />\n";

}

echo "</div>";



echo "<hr />";

echo "<a href=\"index.php\">&lt;&lt; На главную</a>\n";

foot();

?>

