Файл: ignor.php
Строк: 20
<?php
include 'system/sys.php';
include 'system/funcs.php';
if (!isset ($us)) {
header ('location: /');
exit;
}
$items = DB :: $dbs -> querySingle ("SELECT COUNT(*) FROM `ignor` WHERE (`us`='" . $us['id'] . "')");
H ('Игнор-лист', 'Ваш игнор-лист (' . $items . ' чел.)');
$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 {
if (isset ($_GET['del'])) {
$_GET['del'] = (int) $_GET['del'];
if (DB :: $dbs -> querySingle ("SELECT COUNT(*) FROM `ignor` WHERE (`us`='" . $us['id'] . "') AND (`kem`=?)", array ($_GET['del'])) != 0) {
DB :: $dbs -> query ("DELETE FROM `ignor` WHERE (`us`='" . $us['id'] . "') AND (`kem`=?)", array ($_GET['del']));
}
header ('location: /ignor.php');
}
$query = DB :: $dbs -> query ("SELECT * FROM `ignor` WHERE (`us`='" . $us['id'] . "') LIMIT $start, $items_per_page");
while ($ignor = $query -> fetch ()) {
echo '<div class="lst">' . uNick ($ignor['kem']) . ' [<a href="/ignor.php?del=' . $ignor['kem'] . '">x</a>]</div>';
}
echo '<div class="list1"><a href="/kab">Личный кабинет</a></div>';
echo '<div class="lst">' . pages ('/ignor') . '</div>';
}
F ();
?>