Файл: 4mast/profmas.ru/mail.php
Строк: 12
<?php
require_once('includes/Headers.php');
require_once('includes/PDO_func.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 );
if ($page < 1)
$page = 1;
if ($page > $pages)
$page = $pages;
$start = $page * $items_per_page - $items_per_page;
if ($items == 0) {
echo '<div class="error">Контактов нет..</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="block">';
echo Nick ($mail['kem']) . ' [<a href="/mail' . $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 '' . page ('/mail') . '';
}
require_once('includes/Footers.php');
?>