Location: PHPKode > projects > XennoBB > xennobb/admin/users.php
<?php
/*

  Copyright (C) 2005-2011 UserDot
  Visit XennoBB at www.userdot.net/projects/xennobb
  Originally based on PunBB www.punbb.org

  XennoBB is free software; you can redistribute it and/or modify it
  under the terms of the GNU General Public License as published
  by the Free Software Foundation; either version 2 of the License,
  or (at your option) any later version.

  XennoBB is distributed in the hope that it will be useful, but
  WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program; if not, write to the Free Software
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  MA 02110-1301 USA

 */
define('IN_FORUM_ADMIN', 1);
require dirname(__FILE__) . '/../include/init.php';
if ($forum_user['g_id'] > USER_MOD && !$forum_user['g_global_moderation'])
    BB_Functions::Message($lang['No permission'], true, 1);
$page = isset($_GET['Page']) ? BB_Input::Htmlspecialchars($_GET['Page']) : null;
$submenu = array($lang['Add'] => 'users.php?Page=Add', $lang['Search'] => 'users.php?Page=Search', $lang['Prune'] => 'users.php?Page=Prune');
if (isset($_POST['prune']))
{
    if ((trim($_POST['days']) == '') || trim($_POST['posts']) == '')
        BB_Functions::Message($lang['You need to set all settings!']);
    if ($_POST['admods_delete'])
        $admod_delete = 'gid > 0';
    else
        $admod_delete = 'gid > 3';
    if ($_POST['verified'] == 1)
        $verified = '';
    elseif ($_POST['verified'] == 0)
        $verified = 'AND (gid < USER_UNVERIFIED)';
    else
        $verified = 'AND (gid = USER_UNVERIFIED)';
    $prune = ($_POST['prune_by'] == 1) ? 'registered' : 'last_visit';
    $user_time = time() - ($_POST['days'] * 86400);
    $result = $db->query('DELETE FROM ' . $db->prefix . 'users WHERE (num_posts < ' . $db->escape($_POST['posts']) . ') AND (' . $db->escape($prune) . ' < ' . $db->escape($user_time) . ') AND (id > 2) AND (' . $admod_delete . ')' . $verified, true) or BB_Functions::Error($lang['Unable to delete users'], __FILE__, __LINE__, $db->error());
    $users_pruned = $db->affected_rows();
    BB_Admin_Functions::Log_Action('Users pruned', 3);
    BB_Functions::Redirect('users.php?Page=Prune', $lang['redirect_users_pruned']);
}
elseif (isset($_POST['add_user']))
{
    $username = BB_Input::Trim($_POST['username']);
    $email1 = strtolower(trim($_POST['email']));
    $email2 = strtolower(trim($_POST['email']));
    if ($_POST['random_pass'] == '1')
    {
        $password1 = BB_Input::Random_Pass(8);
        $password2 = $password1;
    }
    else
    {
        $password1 = trim($_POST['password']);
        $password2 = trim($_POST['password']);
    }
    $username = preg_replace('#\s+#s', ' ', $username);
    if (strlen($username) < 2)
        BB_Functions::Message($lang['Username too short']);
    else if (BB_Input::Strlen($username) > 25)
        BB_Functions::Message($lang['Bad request']);
    else if (strlen($password1) < 4)
        BB_Functions::Message($lang['Pass too short']);
    else if ($password1 != $password2)
        BB_Functions::Message($lang['Pass not match']);
    else if (!strcasecmp($username, 'Guest') || !strcasecmp($username, $lang['Guest']))
        BB_Functions::Message($lang['Username guest']);
    else if (preg_match('/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/', $username))
        BB_Functions::Message($lang['Username IP']);
    else if ((strpos($username, '[') !== false || strpos($username, ']') !== false) && strpos($username, '\'') !== false && strpos($username, '"') !== false)
        BB_Functions::Message($lang['Username reserved chars']);
    else if (preg_match('#\[b\]|\[/b\]|\[u\]|\[/u\]|\[i\]|\[/i\]|\[color|\[/color\]|\[quote\]|\[quote=|\[/quote\]|\[code\]|\[/code\]|\[img\]|\[/img\]|\[url|\[/url\]|\[email|\[/email\]#i', $username))
        BB_Functions::Message($lang['Username BBCode']);
    if (bb_censoring == '1')
    {
        if (BB_Input::Censor_Words($username) != $username)
            BB_Functions::Message($lang['Username censor']);
    }
    $result = $db->query('SELECT username FROM ' . $db->prefix . 'users WHERE username=\'' . $db->escape($username) . '\' OR username=\'' . $db->escape(preg_replace('/[^\w]/', '', $username)) . '\'') or BB_Functions::Error($lang['Unable to fetch user info'], __FILE__, __LINE__, $db->error());
    if ($db->num_rows($result))
    {
        $busy = $db->result($result);
        BB_Functions::Message($lang['Username dupe 1'] . ' ' . BB_Input::Htmlspecialchars($busy) . '. ' . $lang['Username dupe 2']);
    }
    if (!BB_Email::Is_Valid_Email($email1))
        BB_Functions::Message($lang['Invalid e-mail']);
    $dupe_list = array();
    $result = $db->query('SELECT username FROM ' . $db->prefix . 'users WHERE email=\'' . $email1 . '\'') or BB_Functions::Error($lang['Unable to fetch user info'], __FILE__, __LINE__, $db->error());
    if ($db->num_rows($result))
    {
        while ($cur_dupe = $db->fetch_assoc($result))
            $dupe_list[] = $cur_dupe['username'];
    }
    $timezone = '0';
    $language = isset($_POST['language']) ? $_POST['language'] : bb_default_lang;
    $save_pass = (!isset($_POST['save_pass']) || $_POST['save_pass'] != '1') ? '0' : '1';
    $email_setting = intval(1);
    $now = time();
    $initial_gid = ($_POST['random_pass'] == '0') ? bb_default_user_group : USER_UNVERIFIED;
    $password_hash = BB_Input::Hash($password1);
    $db->query('INSERT INTO ' . $db->prefix . 'users (username, gid, password, email, email_setting, save_pass, timezone, language, template, registered, registration_ip, last_visit) VALUES(\'' . $db->escape($username) . '\', ' . $initial_gid . ', \'' . $password_hash . '\', \'' . $email1 . '\', ' . $email_setting . ', ' . $save_pass . ', ' . $timezone . ' , \'' . $language . '\', \'' . bb_default_style . '\', ' . $now . ', \'' . BB_Input::Get_Remote_Address() . '\', ' . $now . ')') or BB_Functions::Error($lang['error_29'], __FILE__, __LINE__, $db->error());
    $new_uid = $db->insert_id();
    if (bb_regs_report == '1')
    {
        $mail_subject = 'Alert - New registration';
        $mail_message = 'User \'' . $username . '\' registered in the forums at ' . bb_forum_url . "\n\n" . 'User profile: ' . bb_forum_url . '/member.php?id=' . $new_uid . "\n\n" . '-- ' . "\n" . 'Forum Mailer' . "\n" . '(Do not reply to this message)';
        BB_Email::Mail(bb_mailing_list, $mail_subject, $mail_message);
    }
    if ($_POST['random_pass'] == '1')
    {
        $mail_tpl = trim(file_get_contents(FORUM_ROOT . 'include/languages/' . $forum_user['language'] . '/mail_templates/welcome.tpl'));
        $first_crlf = strpos($mail_tpl, "\n");
        $mail_subject = trim(substr($mail_tpl, 8, $first_crlf - 8));
        $mail_message = trim(substr($mail_tpl, $first_crlf));
        $mail_subject = str_replace('<board_title>', bb_board_title, $mail_subject);
        $mail_message = str_replace('<base_url>', bb_forum_url . '/', $mail_message);
        $mail_message = str_replace('<username>', $username, $mail_message);
        $mail_message = str_replace('<password>', $password1, $mail_message);
        $mail_message = str_replace('<login_url>', bb_forum_url . '/login.php', $mail_message);
        $mail_message = str_replace('<board_mailer>', bb_board_title . ' ' . $lang['Mailer'], $mail_message);
        BB_Email::Mail($email1, $mail_subject, $mail_message);
    }
    BB_Admin_Functions::Log_Action('New user added' . $username, 1);
    BB_Functions::Redirect('users.php?Page=Add', $lang['redirect_users_add']);
}
if (isset($_GET['ip_stats']))
{
    $ip_stats = intval($_GET['ip_stats']);
    if ($ip_stats < 1)
        BB_Functions::Message($lang['Bad request']);
    $page_title = BB_Input::Htmlspecialchars($lang['Admin'] . $lang['Users']);
    require FORUM_ROOT . 'admin/header.php';
    ?>
    <div id="users1" class="blockform">
        <h2><span><?php echo $lang['Users']; ?></span></h2>
        <div class="box">
            <div class="inbox">
                <table cellspacing="0">
                    <thead>
                        <tr>
                            <th class="tcl"><?php echo $lang['IP address']; ?></th>
                            <th class="tc2"><?php echo $lang['Last used']; ?></th>
                            <th class="tc3"><?php echo $lang['Times found']; ?></th>
                            <th class="tcr"><?php echo $lang['Action']; ?></th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php
                        $result = $db->query('SELECT poster_ip, MAX(posted) AS last_used, COUNT(id) AS used_times FROM ' . $db->prefix . 'posts WHERE poster_id=' . $db->escape($ip_stats) . ' GROUP BY poster_ip ORDER BY last_used DESC') or BB_Functions::Error($lang['Unable to fetch post info'], __FILE__, __LINE__, $db->error());
                        if ($db->num_rows($result))
                        {
                            while ($cur_ip = $db->fetch_assoc($result))
                            {
                                ?>
                                <tr>
                                    <td class="tcl"><a href="moderate.php?get_host=<?php echo $cur_ip['poster_ip'] ?>"><?php echo $cur_ip['poster_ip'] ?></a></td>
                                    <td class="tc2"><?php echo BB_Input::Format_Time($cur_ip['last_used']) ?></td>
                                    <td class="tc3"><?php echo $cur_ip['used_times'] ?></td>
                                    <td class="tcr"><a href="users.php?show_users=<?php echo $cur_ip['poster_ip'] ?>"><?php echo $lang['find_more_users']; ?></a></td>
                                </tr>
                                <?php
                            }
                        }
                        else
                            echo "\t\t\t\t" . '<tr><td class="tcl" colspan="4">' . $lang['no_posts_by_user'] . '</td></tr>' . "\n";
                        ?>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
    <div class="linksb">
        <div class="inbox">
            <div><input type="button" class="b1" onclick="javascript:history.go(-1)" value="<?php echo $lang['Go back'] ?>"></div>
        </div>
    </div>
    <?php
    require FORUM_ROOT . 'admin/footer.php';
}
if (isset($_GET['show_users']))
{
    $ip = $_GET['show_users'];
    if (!preg_match('/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/', $ip))
        BB_Functions::Message($lang['ip_incorrect']);
    $page_title = BB_Input::Htmlspecialchars(bb_board_title) . $lang['Admin'] . $lang['Users'];
    require FORUM_ROOT . 'admin/header.php';
    ?>
    <div class="blockform">
        <h2><span><?php echo $lang['Users']; ?></span></h2>
        <div class="box">
            <div class="inbox">
                <table cellspacing="0">
                    <thead>
                        <tr>
                            <th class="tcl"><?php echo $lang['Username']; ?></th>
                            <th class="tc2"><?php echo $lang['E-Mail']; ?></th>
                            <th class="tc3"><?php echo $lang['Title/Status']; ?></th>
                            <th class="tc4"><?php echo $lang['Posts']; ?></th>
                            <th class="tc5"><?php echo $lang['Admin_note']; ?></th>
                            <th class="tcr"><?php echo $lang['Actions']; ?></th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php
                        $result = $db->query('SELECT DISTINCT poster_id, poster FROM ' . $db->prefix . 'posts WHERE poster_ip=\'' . $db->escape($ip) . '\' ORDER BY poster DESC') or BB_Functions::Error($lang['Unable to fetch post info'], __FILE__, __LINE__, $db->error());
                        $num_posts = $db->num_rows($result);
                        if ($num_posts)
                        {
                            for ($i = 0; $i < $num_posts; ++$i)
                            {
                                list($poster_id, $poster) = $db->fetch_row($result);
                                $result2 = $db->query('SELECT u.id, u.username, u.email, u.title, u.num_posts, u.admin_note, g.g_id, g.g_user_title FROM ' . $db->prefix . 'users AS u INNER JOIN ' . $db->prefix . 'usergroups AS g ON g.g_id=u.gid WHERE u.id>1 AND u.id=' . $db->escape($poster_id)) or BB_Functions::Error($lang['Unable to fetch user info'], __FILE__, __LINE__, $db->error());
                                if (($user_data = $db->fetch_assoc($result2)))
                                {
                                    $user_title = BB_Core::Get_User_Title($user_data);
                                    $actions = '<a href="users.php?ip_stats=' . $user_data['id'] . '">' . $lang['View IP stats'] . '</a> - <a href="' . bb_forum_url . 'search.php?action=show_user&amp;user_id=' . $user_data['id'] . '">' . $lang['Show posts'] . '</a>';
                                    ?>
                                    <tr>
                                        <td class="tcl"><?php echo '<a href="../member.php?id=' . $user_data['id'] . '">' . BB_Input::Htmlspecialchars($user_data['username']) . '</a>' ?></td>
                                        <td class="tc2"><a href="mailto:<?php echo $user_data['email'] ?>"><?php echo $user_data['email'] ?></a></td>
                                        <td class="tc3"><?php echo $user_title ?></td>
                                        <td class="tc4"><?php echo $user_data['num_posts'] ?></td>
                                        <td class="tc5"><?php echo ($user_data['admin_note'] != '') ? $user_data['admin_note'] : '&nbsp;' ?></td>
                                        <td class="tcr"><?php echo $actions ?></td>
                                    </tr>
                                    <?php
                                }
                                else
                                {
                                    ?>
                                    <tr>
                                        <td class="tcl"><?php echo BB_Input::Htmlspecialchars($poster) ?></td>
                                        <td class="tc2">&nbsp;</td>
                                        <td class="tc3"><?php echo $lang['Guest']; ?></td>
                                        <td class="tc4">&nbsp;</td>
                                        <td class="tc5">&nbsp;</td>
                                        <td class="tcr">&nbsp;</td>
                                    </tr>
                                    <?php
                                }
                            }
                        }
                        else
                            echo "\t\t\t\t" . '<tr><td class="tcl" colspan="6">' . $lang['ip_not_in_db'] . '</td></tr>' . "\n";
                        ?>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
    <div class="linksb">
        <div class="inbox">
            <div><input type="button" class="b1" onclick="javascript:history.go(-1)" value="<?php echo $lang['Go back'] ?>"></div>
        </div>
    </div>
    <?php
    require FORUM_ROOT . 'admin/footer.php';
}
else if (isset($_POST['find_user']))
{
    $form = $_POST['form'];
    $form['username'] = $_POST['username'];
    $form = array_map('trim', $form);
    $conditions = array();
    $posts_greater = trim($_POST['posts_greater']);
    $posts_less = trim($_POST['posts_less']);
    $last_post_after = trim($_POST['last_post_after']);
    $last_post_before = trim($_POST['last_post_before']);
    $registered_after = trim($_POST['registered_after']);
    $registered_before = trim($_POST['registered_before']);
    $order_by = $_POST['order_by'];
    $direction = $_POST['direction'];
    $user_group = $_POST['user_group'];
    if (preg_match('/[^0-9]/', $posts_greater . $posts_less))
        BB_Functions::Message($lang['no_numeric_into_numeric']);
    if ($last_post_after != '')
        $last_post_after = strtotime($last_post_after);
    if ($last_post_before != '')
        $last_post_before = strtotime($last_post_before);
    if ($registered_after != '')
        $registered_after = strtotime($registered_after);
    if ($registered_before != '')
        $registered_before = strtotime($registered_before);
    if ($last_post_after == -1 || $last_post_before == -1 || $registered_after == -1 || $registered_before == -1)
        BB_Functions::Message($lang['invalid_date']);
    if ($last_post_after != '')
        $conditions[] = 'u.last_post>' . $last_post_after;
    if ($last_post_before != '')
        $conditions[] = 'u.last_post<' . $last_post_before;
    if ($registered_after != '')
        $conditions[] = 'u.registered>' . $registered_after;
    if ($registered_before != '')
        $conditions[] = 'u.registered<' . $registered_before;
    $like_command = ($db_type == 'pgsql') ? 'ILIKE' : 'LIKE';
    while (list($key, $input) = @each($form))
    {
        if ($input != '' && in_array($key, array('username', 'email', 'title', 'realname', 'url', 'jabber', 'icq', 'msn', 'aim', 'yahoo', 'location', 'signature', 'admin_note')))
            $conditions[] = 'u.' . $db->escape($key) . ' ' . $like_command . ' \'' . $db->escape(str_replace('*', '%', $input)) . '\'';
    }
    if ($posts_greater != '')
        $conditions[] = 'u.num_posts>' . $posts_greater;
    if ($posts_less != '')
        $conditions[] = 'u.num_posts<' . $posts_less;
    if ($user_group != 'all')
        $conditions[] = 'u.group_id=' . intval($user_group);
    if (empty($conditions))
        BB_Functions::Message($lang['You did not enter any search terms.']);
    $page_title = BB_Input::Htmlspecialchars($lang['Admin'] . $lang['Users']);
    require FORUM_ROOT . 'admin/header.php';
    ?>
    <div class="blockform">
        <h2><span><?php echo $lang['Users']; ?></span></h2>
        <div class="box">
            <div class="inbox">
                <table cellspacing="0">
                    <thead>
                        <tr>
                            <th class="tcl"><?php echo $lang['Username']; ?></th>
                            <th class="tc2"><?php echo $lang['E-Mail']; ?></th>
                            <th class="tc3"><?php echo $lang['Title/Status']; ?></th>
                            <th class="tc4"><?php echo $lang['Posts']; ?></th>
                            <th class="tc5"><?php echo $lang['Admin_note']; ?></th>
                            <th class="tcr"><?php echo $lang['Actions']; ?></th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php
                        $result = $db->query('SELECT u.id, u.username, u.email, u.title, u.num_posts, u.admin_note, g.g_id, g.g_user_title FROM ' . $db->prefix . 'users AS u LEFT JOIN ' . $db->prefix . 'usergroups AS g ON g.g_id=u.gid WHERE u.id>1 AND ' . implode(' AND ', $conditions) . ' ORDER BY ' . $db->escape($order_by) . ' ' . $db->escape($direction)) or BB_Functions::Error($lang['Unable to fetch user info'], __FILE__, __LINE__, $db->error());
                        if ($db->num_rows($result))
                        {
                            while ($user_data = $db->fetch_assoc($result))
                            {
                                $user_title = BB_Core::Get_User_Title($user_data);
                                if (($user_data['g_id'] == '' || $user_data['g_id'] == USER_UNVERIFIED) && $user_title != $lang['Banned'])
                                    $user_title = '<span class="warntext">' . $lang['Not verified'] . '</span>';
                                $actions = '<a href="users.php?ip_stats=' . $user_data['id'] . '">' . $lang['View IP stats'] . '</a> - <a href="' . bb_forum_url . 'search.php?action=show_user&amp;user_id=' . $user_data['id'] . '">' . $lang['Show posts'] . '</a>';
                                ?>
                                <tr>
                                    <td class="tcl"><?php echo '<a href="' . bb_forum_url . 'member.php?id=' . $user_data['id'] . '">' . BB_Input::Htmlspecialchars($user_data['username']) . '</a>' ?></td>
                                    <td class="tc2"><a href="mailto:<?php echo $user_data['email'] ?>"><?php echo $user_data['email'] ?></a></td>
                                    <td class="tc3"><?php echo $user_title ?></td>
                                    <td class="tc4"><?php echo $user_data['num_posts'] ?></td>
                                    <td class="tc5"><?php echo ($user_data['admin_note'] != '') ? $user_data['admin_note'] : '&nbsp;' ?></td>
                                    <td class="tcr"><?php echo $actions ?></td>
                                </tr>
                                <?php
                            }
                        }
                        else
                            echo "\t\t\t\t" . '<tr><td class="tcl" colspan="6">' . $lang['no_match'] . '</td></tr>' . "\n";
                        ?>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
    <div class="linksb">
        <div class="inbox">
            <div><input type="button" class="b1" onclick="javascript:history.go(-1)" value="<?php echo $lang['Go back'] ?>"></div>
        </div>
    </div>
    <?php
    require FORUM_ROOT . 'admin/footer.php';
}
else
{
    $page_title = BB_Input::Htmlspecialchars($lang['Admin'] . $lang['Users']);
    require FORUM_ROOT . 'admin/header.php';
    if ($page == 'Add')
    {
        echo BB_Template::Generate_Menu($submenu);
        if ($forum_user['g_id'] == USER_ADMIN)
        {
            ?>
            <div class="blockform">
                <form id="example" method="post" action="<?php echo $_SERVER['REQUEST_URI'] ?>">
                    <div class="inform">
                        <div class="infldset file" style="padding:10px">
                            <table class="aligntop" cellspacing="0">
                                <tr>
                                    <th class="header"><?php echo $lang['Username'] ?></th>
                                    <td class="tips"><?php BB_Template::Print_Tooltip($lang['tip_4']) ?></td>
                                    <td><input type="text" class="textbox" name="username" size="25" tabindex="3" /></td>
                                </tr>
                                <tr>
                                    <th class="header"><?php echo $lang['E-Mail'] ?></th>
                                    <td class="tips"><?php BB_Template::Print_Tooltip($lang['tip_5']) ?></td>
                                    <td><input type="text" class="textbox" name="email" size="25" tabindex="3" /></td>
                                </tr>
                                <tr>
                                    <th class="header"><?php echo $lang['Generate random password'] ?></th>
                                    <td class="tips"><?php BB_Template::Print_Tooltip($lang['tip_36']) ?></td>
                                    <td><input type="radio" name="random_pass" value="1" />&nbsp;<?php echo $lang['Yes'] ?>&nbsp;&nbsp;&nbsp;<input type="radio" name="random_pass" value="0" checked="checked" />&nbsp;<?php echo $lang['No'] ?></td>
                                </tr>
                                <tr>
                                    <th class="header"><?php echo $lang['Password'] ?></th>
                                    <td class="tips"><?php BB_Template::Print_Tooltip($lang['tip_37']) ?></td>
                                    <td><input type="text" class="textbox" name="password" size="25" tabindex="3" /></td>
                                </tr>
                            </table>
                        </div>
                    </div>
                    <div><input type="submit" class="b1" name="add_user" value="<?php echo $lang['Add'] ?>" tabindex="4" /></div>
                </form>
            </div>
            <?php
        }
    }
    else if ($page == 'Search')
    {
        echo BB_Template::Generate_Menu($submenu);
        $focus_element = array('find_user', 'username');
        ?>
        <div class="blockform">
            <form id="find_user" method="post" action="users.php?action=find_user">
                <div class="inform">
                    <div class="infldset file" style="padding:10px">
                        <p><?php echo $lang['help_user_search'] ?></p>
                    </div>
                </div>
                <div class="inform">
                    <div class="infldset file" style="padding:10px">
                        <table  class="aligntop" cellspacing="0">
                            <tr>
                                <th class="header"><?php echo $lang['Username'] ?></th>
                                <td class="tips">&nbsp;</td>
                                <td><input type="text" class="textbox" name="username" size="30" maxlength="25" tabindex="2" /></td>
                            </tr>
                            <tr>
                                <th class="header"><?php echo $lang['E-Mail'] ?></th>
                                <td class="tips">&nbsp;</td>
                                <td><input type="text" class="textbox" name="form[email]" size="30" maxlength="50" tabindex="3" /></td>
                            </tr>
                            <tr>
                                <th class="header"><?php echo $lang['Title'] ?></th>
                                <td class="tips">&nbsp;</td>
                                <td><input type="text" class="textbox" name="form[title]" size="30" maxlength="50" tabindex="4" /></td>
                            </tr>
                            <tr>
                                <th class="header"><?php echo $lang['Real name'] ?></th>
                                <td class="tips">&nbsp;</td>
                                <td><input type="text" class="textbox" name="form[realname]" size="30" maxlength="40" tabindex="5" /></td>
                            </tr>
                            <tr>
                                <th class="header"><?php echo $lang['Website'] ?></th>
                                <td class="tips">&nbsp;</td>
                                <td><input type="text" class="textbox" name="form[url]" size="30" maxlength="100" tabindex="6" /></td>
                            </tr>
                            <tr>
                                <th class="header"><?php echo $lang['Jabber'] ?></th>
                                <td class="tips">&nbsp;</td>
                                <td><input type="text" class="textbox" name="form[jabber]" size="30" maxlength="12" tabindex="7" /></td>
                            </tr>
                            <tr>
                                <th class="header"><?php echo $lang['ICQ'] ?></th>
                                <td class="tips">&nbsp;</td>
                                <td><input type="text" class="textbox" name="form[icq]" size="30" maxlength="12" tabindex="7" /></td>
                            </tr>
                            <tr>
                                <th class="header"><?php echo $lang['MSN'] ?></th>
                                <td class="tips">&nbsp;</td>
                                <td><input type="text" class="textbox" name="form[msn]" size="30" maxlength="50" tabindex="8" /></td>
                            </tr>
                            <tr>
                                <th class="header"><?php echo $lang['AOL IM'] ?></th>
                                <td class="tips">&nbsp;</td>
                                <td><input type="text" class="textbox" name="form[aim]" size="30" maxlength="20" tabindex="9" /></td>
                            </tr>
                            <tr>
                                <th class="header"><?php echo $lang['Yahoo'] ?></th>
                                <td class="tips">&nbsp;</td>
                                <td><input type="text" class="textbox" name="form[yahoo]" size="30" maxlength="20" tabindex="10" /></td>
                            </tr>
                            <tr>
                                <th class="header"><?php echo $lang['Location'] ?></th>
                                <td class="header">&nbsp;</td>
                                <td><input type="text" class="textbox" name="form[location]" size="30" maxlength="30" tabindex="11" /></td>
                            </tr>
                            <tr>
                                <th class="header"><?php echo $lang['Signature'] ?></th>
                                <td class="tips">&nbsp;</td>
                                <td><input type="text" class="textbox" name="form[signature]" size="30" maxlength="512" tabindex="12" /></td>
                            </tr>
                            <tr>
                                <th class="header"><?php echo $lang['Admin_note'] ?></th>
                                <td class="tips">&nbsp;</td>
                                <td><input type="text" class="textbox" name="form[admin_note]" size="30" maxlength="30" tabindex="13" /></td>
                            </tr>
                            <tr>
                                <th class="header"><?php echo $lang['Number of posts greater than'] ?></th>
                                <td class="tips">&nbsp;</td>
                                <td><input type="text" class="textbox" name="posts_greater" size="5" maxlength="8" tabindex="14" /></td>
                            </tr>
                            <tr>
                                <th class="header"><?php echo $lang['Number of posts less than'] ?></th>
                                <td class="tips">&nbsp;</td>
                                <td><input type="text" class="textbox" name="posts_less" size="5" maxlength="8" tabindex="15" /></td>
                            </tr>
                            <tr>
                                <th class="header"><?php echo $lang['Last post is after'] ?></th>
                                <td class="header"><?php BB_Template::Print_Tooltip('(yyyy-mm-dd hh:mm:ss)') ?></td>
                                <td><input type="text" class="textbox" name="last_post_after" size="30" maxlength="19" tabindex="16" /></td>
                            </tr>
                            <tr>
                                <th class="header"><?php echo $lang['Last post is before'] ?></th>
                                <td class="tips"><?php BB_Template::Print_Tooltip('(yyyy-mm-dd hh:mm:ss)') ?></td>
                                <td><input type="text" class="textbox" name="last_post_before" size="30" maxlength="19" tabindex="17" /></td>
                            </tr>
                            <tr>
                                <th class="header"><?php echo $lang['Registered after'] ?></th>
                                <td class="tips"><?php BB_Template::Print_Tooltip('(yyyy-mm-dd hh:mm:ss)') ?></td>
                                <td><input type="text" class="textbox" name="registered_after" size="30" maxlength="19" tabindex="18" /></td>
                            </tr>
                            <tr>
                                <th class="header"><?php echo $lang['Registered before'] ?></th>
                                <td class="tips"><?php BB_Template::Print_Tooltip('(yyyy-mm-dd hh:mm:ss)') ?></td>
                                <td><input type="text" class="textbox" name="registered_before" size="30" maxlength="19" tabindex="19" /></td>
                            </tr>
                            <tr>
                                <th class="header"><?php echo $lang['Order by'] ?></th>
                                <td class="tips">&nbsp;</td>
                                <td>
                                    <select name="order_by" tabindex="20">
                                        <option value="username" selected="selected"><?php echo $lang['Username'] ?></option>
                                        <option value="email"><?php echo $lang['E-Mail'] ?></option>
                                        <option value="num_posts"><?php echo $lang['Posts'] ?></option>
                                        <option value="last_post"><?php echo $lang['Last post'] ?></option>
                                        <option value="registered"><?php echo $lang['Registered'] ?></option>
                                    </select>&nbsp;&nbsp;&nbsp;<select name="direction" tabindex="21">
                                        <option value="ASC" selected="selected"><?php echo $lang['Ascending'] ?></option>
                                        <option value="DESC"><?php echo $lang['Descending'] ?></option>
                                    </select>
                                </td>
                            </tr>
                            <tr>
                                <th class="header"><?php echo $lang['User group'] ?></th>
                                <td class="tips">&nbsp;</td>
                                <td>
                                    <select name="user_group" tabindex="22">
                                        <option value="all" selected="selected"><?php echo $lang['All groups'] ?></option>
                                        <?php
                                        $result = $db->query('SELECT g_id, g_title FROM ' . $db->prefix . 'usergroups WHERE g_id!=' . USER_GUEST . ' ORDER BY g_title') or BB_Functions::Error($lang['Unable to fetch user group list'], __FILE__, __LINE__, $db->error());
                                        while ($cur_group = $db->fetch_assoc($result))
                                            echo "\t\t\t\t\t\t\t\t\t\t\t" . '<option value="' . $cur_group['g_id'] . '">' . BB_Input::Htmlspecialchars($cur_group['g_title']) . '</option>' . "\n";
                                        ?>
                                    </select>
                                </td>
                            </tr>
                        </table>
                    </div>
                </div>
                <div><input type="submit" class="b1" name="find_user" value="<?php echo $lang['Search'] ?>" tabindex="23" /></div>
            </form>
            <h2><?php echo $lang['help_ip_search'] ?></h2>
            <form method="get" action="users.php">
                <div class="inform">
                    <div class="infldset file" style="padding:10px">
                        <table class="aligntop" cellspacing="0">
                            <tr>
                                <th class="header">IP address</th>
                                <td class="tips"><?php BB_Template::Print_Tooltip($lang['tip_38']) ?></td>
                                <td><input type="text" class="textbox" name="show_users" size="30" maxlength="15" tabindex="24" />
                            </tr>
                        </table>
                    </div>
                </div>
                <div><input class="b1" type="submit" value="<?php echo $lang['Find'] ?>" tabindex="25" /></div>
            </form>
        </div>
        <?php
    }
    else if ($page == 'Prune')
    {
        echo BB_Template::Generate_Menu($submenu);
        if ($forum_user['g_id'] == USER_ADMIN)
        {
            ?>
            <div class="blockform">
                <form id="example" method="post" action="<?php echo $_SERVER['REQUEST_URI'] ?>">
                    <div class="inform">
                        <div class="infldset file" style="padding:10px">
                            <table class="aligntop" cellspacing="0">
                                <tr>
                                    <th class="header"><?php echo $lang['Prune by'] ?></th>
                                    <td class="tips"><?php BB_Template::Print_Tooltip($lang['tip_39']) ?></td>
                                    <td><input type="radio" name="prune_by" value="1" checked="checked" />&nbsp;<?php echo $lang['Registered date'] ?>&nbsp;&nbsp;&nbsp;<input type="radio" name="prune_by" value="0" />&nbsp;<?php echo $lang['Last Login'] ?></td>
                                </tr>
                                <tr>
                                    <th class="header"><?php echo $lang['Minimum days since registration/last login'] ?></th>
                                    <td class="tips"><?php BB_Template::Print_Tooltip($lang['tip_40']) ?></td>
                                    <td><input type="text" class="textbox" name="days" value="28" size="10" maxlength="4" tabindex="1" /></td>
                                </tr>
                                <tr>
                                    <th class="header"><?php echo $lang['Maximum number of posts'] ?></th>
                                    <td class="tips"><?php BB_Template::Print_Tooltip($lang['tip_41']) ?></td>
                                    <td><input type="text" class="textbox" name="posts" value="1"  size="10" tabindex="1" /></td>
                                </tr>
                                <tr>
                                    <th class="header"><?php echo $lang['Delete admins and mods?'] ?></th>
                                    <td class="tips"><?php BB_Template::Print_Tooltip($lang['tip_42']) ?></td>
                                    <td><input type="radio" name="admods_delete" value="1" />&nbsp;<?php echo $lang['Yes'] ?>&nbsp;&nbsp;&nbsp;<input type="radio" name="admods_delete" value="0" checked="checked" />&nbsp;<?php echo $lang['No'] ?></td>
                                </tr>
                                <tr>
                                    <th class="header"><?php echo $lang['User status'] ?></th>
                                    <td class="tips"><?php BB_Template::Print_Tooltip($lang['tip_43']) ?></td>
                                    <td><input type="radio" name="verified" value="1" />&nbsp;<?php echo $lang['Delete any'] ?>&nbsp;&nbsp;&nbsp;<input type="radio" name="verified" value="0" checked="checked" />&nbsp;<?php echo $lang['Delete only verified'] ?>&nbsp;&nbsp;&nbsp;<input type="radio" name="verified" value="2" />&nbsp;<?php echo $lang['Delete only unverified'] ?></td>
                                </tr>
                            </table>
                        </div>
                    </div>
                    <div><input type="submit" class="b1" name="prune" value="<?php echo $lang['Prune'] ?>" tabindex="2" /></div>
                </form>
            </div>
            <?php
        }
    }
    else
        BB_Functions::Message($lang['Bad request']);
    require FORUM_ROOT . 'admin/footer.php';
}
?>
Return current item: XennoBB