<?php

require_once('conf/dbc.php');
require_once('conf/session_start.php');
require_once('conf/ban.php');
if ((!isset($_SESSION['id'])) or (!isset($_SESSION['nick'])))  {
?>
<script type="text/javascript">
  document.location.href = "reg.php?err_login=1";
</script>
<?php
}
$page_title = 'Почта';
require_once('conf/head.php');
require_once('conf/top.php');
$user_id = abs(intval($_SESSION['id']));
$row=$dbc->query("SELECT * FROM `users` WHERE`id`='$user_id' LIMIT 1")->fetch_assoc();

$mes = $pdo->query("SELECT COUNT(id) FROM `messages` WHERE `komy` = '".$user_id."' and `readlen` = '0'")->fetchColumn();
?><br/>
<center><div class="name">Почта</div></center>

	<div class="menu3"><div class="menu3_text">
<a class='touch' href="mes.php">
<?php if ($mes > '0') { echo '<img src="/img/ico/newletter.png" alt="" height="12" width="12"/>';}?>
<?php if ($mes == '0') { echo '<img src="/img/ico/letter.png" alt="" height="12" width="12"/>';}?> Личные сообщения <?php if ($mes > 0) { echo '<span class="bonus">(+'.$mes.')</span>';}?></a>
	<br/>
<a class='touch' href="mail.php">
<?php if ($row['message'] > '0') { echo '<img src="/img/ico/newletter.png" alt="" height="12" width="12"/>';}?>
<?php if ($row['message'] == '0') { echo '<img src="/img/ico/letter.png" alt="" height="12" width="12"/>';}?> Посылки <?php if ($row['message'] > 0) { echo '<span class="bonus">(+'.$row['message'].')</span>';}?></a>
	

<?php if ($row['clan'] > '0') {echo'<a class="touch" href="chatcompany.php">'; if ($row['clanmes'] > '0') { echo '<img src="/img/ico/newletter.png" alt="" height="12" width="12"/>';}else{ echo '<img src="/img/ico/letter.png" alt="" height="12" width="12"/>';}?>Отрядные сообщения<?php if ($row['clanmes'] > 0) { echo '<span class="bonus">(+'.$row['clanmes'].')</span>';}}?></a>

<?php if ($row['admin'] > '0') {echo'<a class="touch" href="adm_chat.php">'; if ($row['adm_chatmes'] > '0') { echo '<img src="/img/ico/newletter.png" alt="" height="12" width="12"/>';}else{ echo '<img src="/img/ico/letter.png" alt="" height="12" width="12"/>';}?>Комната совещаний<?php if ($row['adm_chatmes'] > 0) { echo '<span class="bonus">(+'.$row['adm_chatmes'].')</span>';}}?></a>
    <a class="touch" href="tiket.php"><img src="/img/ico/tex-mes.gif" alt="" height="15" width="15"/> Техподдержка</a>
	</div></div>
<?php
require_once('conf/navig.php');
require_once('conf/foot.php');
mysqli_close($dbc);
?>

</body>
</html>