Файл: pages/users/index.php
Строк: 170
<?php
include '../../system/mysql.php';
include '../../system/sys_func.php';
switch ($_GET['menu']) {
default:
$title = 'Все пользователи';
include '../../system/head.php';
echo '<div class="title">Все пользователи</div>
<div class="post">
Все | <a href="?menu=online">Онлайн</a> | <a href="?menu=online_guests">Гости</a> | <a href="?menu=visitors">Посетители</a> | <a href="?menu=adm">Администраторы</a>
</div>';
if (isset($_POST['go'])) {
header('Location: ?search='. filter($_POST['search']));
}
if (isset($_GET['search'])) {
$search = filter($_GET['search']);
$c_d = mysql_result(mysql_query("SELECT COUNT(*) FROM `users` WHERE `login` like '%". $search ."%'"), 0);
if (isset($user)) $p_page = $user['p_page'];
else $p_page = '10';
$k_page = k_page($c_d, $p_page);
$page = page($k_page);
$start = $p_page*$page-$p_page;
echo '<form method="post">
<input style="width: 80%" type="text" value="'. $search .'" name="search">
<input type="submit" value="Поиск" name="go"><br>
</form>';
if ($c_d == 0) {
echo '<div class="post">
Поиск не дал результатов!
</div>';
}
$q = mysql_query("SELECT * FROM `users` WHERE `login` like '%". $search ."%' ORDER BY `id` DESC LIMIT $start, ". $p_page);
while ($u_search = mysql_fetch_assoc($q)) {
$ank = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id` = '". $u_search['id'] ."'"));
echo '<div class="post">
<span class="c_date">'. ptime($u_search['time_last']) .'</span>';
echo online($ank['id']);
echo ' <a href="/pages/users/user.php?name='. $ank['login'] .'">'. $ank['login'] .'</a><br>';
echo '</div>';
}
if ($k_page > 1) str('?menu=u_search&id='. $ank['id'] .'&search='. $search .'&', $k_page, $page);
echo '<a class="link" href="index.php"><img src="/design/imgs/arr_b.png" align="center"> Назад</a>';
include H.'system/foot.php';
} else {
$search = filter($_GET['search']);
echo '<form method="post">
<input style="width: 80%" type="text" value="'. $search .'" name="search">
<input type="submit" value="Поиск" name="go"><br>
</form>';
}
$c_p = mysql_result(mysql_query("SELECT COUNT(*) FROM `users`"),0);
if (isset($user)) $p_page = $user['p_page'];
else $p_page = '10';
$k_page = k_page($c_p, $p_page);
$page = page($k_page);
$start = $p_page*$page-$p_page;
if ($c_p == 0) {
echo '<div class="post">
Нет пользователей!
</div>';
}
$q = mysql_query("SELECT * FROM `users` ORDER BY `id` DESC LIMIT $start, ". $p_page);
while ($ank = mysql_fetch_assoc($q)) {
echo '<a class="link" href="/pages/users/user.php?name='. $ank['login'] .'">
<span class="c_date">'. ptime($ank['time_last']) .'</span>
<table cellpadding="0" cellspacing="0">
<tr>
<td>';
avatar($ank['id'], 'b');
echo ' </td>
<td>';
echo online($ank['id']);
echo $ank['login'];
echo user($ank['id']);
echo '</td>
</tr>
</table>
</a>';
}
if ($k_page > 1)str('?', $k_page, $page);
include '../../system/foot.php';
break;
case 'online':
$title = 'Пользователи онлайн';
include '../../system/head.php';
echo '<div class="title">Пользователи онлайн</div>
<div class="post">
<a href="index.php">Все</a> | Онлайн | <a href="?menu=online_guests">Гости</a> | <a href="?menu=visitors">Посетители</a>
</div>';
$c_p = mysql_result(mysql_query("SELECT COUNT(*) FROM `users` WHERE `time_last` > '".(time()-600)."'"),0);
if (isset($user)) $p_page = $user['p_page'];
else $p_page = '10';
$k_page = k_page($c_p, $p_page);
$page = page($k_page);
$start = $p_page*$page-$p_page;
if ($c_p == 0) {
echo '<div class="post">
Нет пользователей!
</div>';
}
$q = mysql_query("SELECT * FROM `users` WHERE `time_last` > '".(time()-600)."' ORDER BY `time_last` DESC LIMIT $start, ". $p_page);
while ($ank = mysql_fetch_assoc($q)) {
echo '<a class="link" href="/pages/users/user.php?name='. $ank['login'] .'">
<span class="c_date">'. ptime($ank['time_last']) .'</span>
<table cellpadding="0" cellspacing="0">
<tr>
<td>';
avatar($ank['id'], 'b');
echo ' </td>
<td>';
echo online($ank['id']);
echo $ank['login'];
echo user($ank['id']);
echo '</td>
</tr>
</table>
</a>';
}
if ($k_page > 1)str('?menu=online&', $k_page, $page);
include '../../system/foot.php';
break;
case 'online_guests':
$title = 'Гости онлайн';
include '../../system/head.php';
echo '<div class="title">Онлайн гости</div>
<div class="post">
<a href="index.php">Все</a> | <a href="?menu=online">Онлайн</a> | Гости | <a href="?menu=visitors">Посетители</a>
</div>';
$c_p = mysql_result(mysql_query("SELECT COUNT(*) FROM `guests` WHERE `time` > '".(time()-600)."'"), 0);
if (isset($user)) $p_page = $user['p_page'];
else $p_page = '10';
$k_page = k_page($c_p, $p_page);
$page = page($k_page);
$start = $p_page*$page-$p_page;
if ($c_p == 0) {
echo '<div class="post">
Нет гостей!
</div>';
}
$q = mysql_query("SELECT * FROM `guests` WHERE `time` > '".(time()-600)."' ORDER BY `time` DESC LIMIT $start, ". $p_page);
while ($post = mysql_fetch_assoc($q)) {
$browser = strtok($post['browser'], '(');
echo '<div class="post">
<img src="/design/imgs/users/guest.png">
<span class="c_date">'. ptime($post['time']) .'</span>';
if (preg_match('#(YandexBot/3.0)#ui', $post['browser'])) {
echo '<b>YandexBot/3.0</b><br>';
} elseif (preg_match('#(Googlebot/2.1)#ui', $post['browser'])) {
echo '<b>Googlebot/2.1</b><br>';
} elseif (preg_match('#(Opera Mini)#ui', $post['browser'])) {
echo '<b>Opera Mini</b><br>';
} elseif (preg_match('#(Chrome/26.0)#ui', $post['browser'])) {
echo '<b>Chrome/26.0</b><br>';
} elseif (preg_match('#(Opera)#ui', $post['browser'])) {
echo '<b>Opera</b><br>';
} else {
echo '<b>'. $browser .'</b><br>';
}
echo 'IP: '. $post['ip'] .'
</div>';
}
if ($k_page > 1)str('?menu=online_guests&', $k_page, $page);
include '../../system/foot.php';
break;
case 'visitors':
$title = 'Посетители';
include '../../system/head.php';
echo '<div class="title">Посетители</div>
<div class="post">
<a href="index.php">Все</a> | <a href="?menu=online">Онлайн</a> | <a href="?menu=online_guests">Гости</a> | Посетители
</div>';
$c_p = mysql_result(mysql_query("SELECT COUNT(*) FROM `users` WHERE `time_last` > '". (time()-43200) ."'"), 0);
if (isset($user)) $p_page = $user['p_page'];
else $p_page = '10';
$k_page = k_page($c_p, $p_page);
$page = page($k_page);
$start = $p_page*$page-$p_page;
if ($c_p == 0) {
echo '<div class="post">
За последние 12 часов, посетителей небыло!
</div>';
}
$q = mysql_query("SELECT * FROM `users` WHERE `time_last` > '". (time()-43200) ."' ORDER BY `time_last` DESC LIMIT $start, ". $p_page);
while ($ank = mysql_fetch_assoc($q)) {
echo '<a class="link" href="/pages/users/user.php?name='. $ank['login'] .'">
<span class="c_date">'. ptime($ank['time_last']) .'</span>
<table cellpadding="0" cellspacing="0">
<tr>
<td>';
avatar($ank['id'], 'b');
echo ' </td>
<td>';
echo online($ank['id']);
echo $ank['login'];
echo user($ank['id']);
echo '</td>
</tr>
</table>
</a>';
}
if ($k_page > 1)str('?menu=visitors&', $k_page, $page);
include '../../system/foot.php';
break;
/*
====================
Вывод пользователей с должностью
====================
*/
case 'adm':
$title = 'Администраторы';
include ('../../system/head.php');
echo '<div class="title">Администраторы</div>
<div class="post">
<a href="index.php">Все</a> | <a href="?menu=online">Онлайн</a> | <a href="?menu=online_guests">Гости</a> | Администраторы
</div>';
$c_p = mysql_result(mysql_query("SELECT COUNT(*) FROM `users` WHERE `position` != 'user'"), 0);
if (isset($user)) $p_page = $user['p_page'];
else $p_page = '10';
$k_page = k_page($c_p, $p_page);
$page = page($k_page);
$start = $p_page*$page-$p_page;
if ($c_p == 0) {
echo '<div class="post">
Нет администраторов
</div>';
}
$q = mysql_query("SELECT `id`,`login`,`time_last` FROM `users` WHERE `position` != 'user' ORDER BY `id` DESC LIMIT $start, ". $p_page);
while ($ank = mysql_fetch_assoc($q)) {
echo '<div class="link"><a href="/pages/users/user.php?name='. $ank['login'] .'">
<span class="c_date">'. ptime($ank['time_last']) .'</span>
<table cellpadding="0" cellspacing="0">
<tr>
<td>';
avatar($ank['id'], 'b');
echo ' </td>
<td>';
echo online($ank['id']);
echo $ank['login'];
echo user($ank['id']);
echo '</td>
</tr>
</table>
</a>
</div>';
}
if ($k_page > 1)str('?menu=adm&', $k_page, $page);
include_once '../../system/foot.php';
break;
}
?>