Файл: adm/ips.php
Строк: 15
<?php
include '../system/sys.php';
include '../system/funcs.php';
if (!isset ($us)) {
header('location: /');
exit;
}
if ($us['level']<1) {
header('location: /');
exit;
}
H ('Поиск по IP', 'Поиск по IP');
echo '<div class="list1">';
echo '<form action="/adm/ips.php" method="GET">';
echo 'IP: <br/><input name="ip"/><br/>';
echo '<input type="submit" value="Поиск"/>';
echo '</form>';
echo '</div>';
if (isset ($_GET['ip'])) {
$_GET['ip'] = htmlspecialchars (addslashes (trim ($_GET['ip'])));
if (!preg_match ('/([0-9]{1,3}).([0-9]{1,3}).([0-9]{1,3}).([0-9]{1,3})/', $_GET['ip'])) {
echo '<div class="list1">Ошибка.</div>';
}
else {
$items_per_page = 10;
$items = DB :: $dbs -> querySingle ("SELECT COUNT(*) FROM `us` WHERE (`ip`=?)", array ($_GET['ip']));
echo '<div class="list1">По вашему запросу ' . endi ($items, array ('результат', 'результата', 'результатов')) . '</div>';
$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 `us` WHERE (`ip`=?)ORDER BY `id` DESC LIMIT $start, $items_per_page", array ($_GET['ip']));
while($u = $query -> fetch()) {
echo '<div class="list1">' . uNick ($u['id']) . '</div>';
}
if ($pages > 1) {
echo '<div class="navg">' . pages ('/adm/ips/' . $_GET['ip']) . '</div>';
}
}
}
}
echo '<div class="navg"><a href="/adm">Вернуться</a></div>';
F ();