Файл: mail.php
Строк: 10
<?php
include 'system/sys.php';
include 'system/funcs.php';
if(!isset ($us['id'])) {
header ('location: /');
exit;
}
H ('Почта', 'Почта');
$items = DB :: $dbs -> querySingle ("SELECT COUNT(*) FROM `poch` WHERE (`us`='" . $us['id'] . "')");
$items_per_page = 10;
$pages = ceil ( $items / $items_per_page );
$page = (int) $_GET['page'];
if ($page < 1)
$page = 1;
if ($page > $pages)
$page = $pages;
$start = $page * $items_per_page - $items_per_page;
if ($items == 0) {
echo '<div class="list1">Контактов нет..</div>';
}
else {
$query = DB :: $dbs -> query ("SELECT * FROM `poch` WHERE (`us`='" . $us['id'] . "') ORDER BY `last` DESC LIMIT $start, $items_per_page");
while ($mail = $query -> fetch ()) {
echo '<div class="lst">';
echo uNick ($mail['kem']) . ' [<a href="/msg' . $mail['kem'] . '">диалог</a>] [<b>' . DB :: $dbs -> querySingle ("SELECT COUNT(*) FROM `msg` WHERE (`us`='" . $us['id'] . "') AND (`kem`='" . $mail['kem'] . "') AND (`see`='1')") . '</b>/' . DB :: $dbs -> querySingle ("SELECT COUNT(id) FROM `msg` WHERE (`us`='" . $us['id'] . "') AND (`kem`='" . $mail['kem'] . "') OR (`kem`='" . $us['id'] . "') AND (`us`='" . $mail['kem'] . "')") . '] [' . datef ($mail['last']) . ']';
echo '</div>';
}
echo '<div class="list1">' . pages ('/mail') . '</div>';
echo '<div class="list1"><a href="/search.php">Поиск контакта</a></div>';
echo '<div class="list1"><a href="/favorit.php">Избранные</a></div>';
echo '<div class="list1"><a href="/ignor.php">Игнор-лист</a></div>';
}
F ();
?>