<?php

defined('_IN_JOHNCMS') or die('Error: restricted access');
$textl = $lng['users_list'];
$headmod = 'userlist';
require('../incfiles/head.php');

/*
-----------------------------------------------------------------
Выводим список пользователей
-----------------------------------------------------------------
*/
$total = mysql_result(mysql_query("SELECT COUNT(*) FROM `users` WHERE `preg` = 1"), 0);
echo '<div><a href="index.'.$akb_for.'"><b>' . $lng['community'] . '</b></a> | ' . $lng['users_list'] . '</div>';
if ($total > $kmess)
    echo  functions::display_pagination('index.'.$akb_for.'?act=userlist&amp;', $start, $total, $kmess) . '</div>';
$req = mysql_query("SELECT `id`, `name`, `sex`, `lastdate`, `datereg`, `status`, `rights`, `ip`, `browser`, `rights` FROM `users` WHERE `preg` = 1 ORDER BY `datereg` DESC LIMIT $start, $kmess");
for ($i = 0; ($res = mysql_fetch_assoc($req)) !== false; $i++) {
    echo $i % 2 ? '<div class="w3-container">' : '<div class="w3-container">';
    echo functions::display_user($res) . '</div>';
}
echo '<div>' . $lng['total'] . ': ' . $total . '</div>';
if ($total > $kmess) {
    echo '<div >' . functions::display_pagination('index.'.$akb_for.'?act=userlist&amp;', $start, $total, $kmess) . '</div>' .
        '<p><form action="index.'.$akb_for.'?act=userlist" method="post">' .
        '<input type="text" name="page" size="2"/>' .
        '<input type="submit" value="' . $lng['to_page'] . ' &gt;&gt;"/>' .
        '</form></p>';
}
echo '<p><a href="search.'.$akb_for.'">' . $lng['search_user'] . '</a><br />' .
    '<a href="index.'.$akb_for.'">' . $lng['back'] . '</a></p>';