if (strpos($item, '*') !== false) {
     $like = 1;
     $item = str_replace('*', '%', $item);
     $item_s = str_replace('\\', '\\\\', $item);
     if ($FUD_OPT_2 & 128) {
         $item_s = htmlspecialchars($item_s);
     }
 } else {
     $like = 0;
     $item_s = $item;
 }
 $item_s = "'" . addslashes($item_s) . "'";
 $c = q('SELECT id, alias, email FROM ' . $DBHOST_TBL_PREFIX . 'users WHERE ' . $field . ($like ? ' LIKE ' : '=') . $item_s . ' LIMIT 50');
 switch ($cnt = db_count($c)) {
     case 0:
         $search_error = errorify('There are no users matching the specified ' . $field . ' mask.');
         unset($c);
         break;
     case 1:
         list($usr_id) = db_rowarr($c);
         $u = db_sab('SELECT * FROM ' . $DBHOST_TBL_PREFIX . 'users WHERE id=' . $usr_id);
         unset($c);
         break;
     default:
         echo 'There are ' . $cnt . ' users that match this ' . $field . ' mask:<br>';
         while ($r = db_rowarr($c)) {
             echo '<a href="admuser.php?usr_id=' . $r[0] . '&act=m&' . _rsidl . '">Pick user</a> <b>' . $r[1] . ' / ' . htmlspecialchars($r[2]) . '</b><br>';
         }
         unset($c);
         exit;
         break;
if (!$error) {
    if ($edit && isset($gl[$edit])) {
        $gr_name = $gl[$edit]['gn'];
        $gr_inherit_id = $gl[$edit]['inherit_id'];
        $perm = $gl[$edit]['groups_opt'];
        $permi = $gl[$edit]['groups_opti'];
    } else {
        /* default form values */
        $gr_ramasks = $gr_name = '';
        $perm = $permi = $gr_inherit_id = 0;
        $gr_resource = array();
    }
}
require $WWW_ROOT_DISK . 'adm/admpanel.php';
if ($error_reason) {
    echo errorify($error_reason);
}
?>
<h2>Admin Group Manager: Add/Edit groups or group leaders</h2>
<form method="post" action="admgroups.php">
<table class="datatable field">
<?php 
echo _hs;
?>
<input type="hidden" name="edit" value="<?php 
echo $edit;
?>
">
<tr><td>Group Name: </td><td>
<?php 
if ($edit && ($edit < 3 || $gl[$edit]['forum_id'])) {