echo '<fieldset id="fieldset_add_user_database">' . "\n"
        . '<legend>' . __('Database for user') . '</legend>' . "\n";

    echo PMA_getCheckbox('createdb-1', __('Create database with same name and grant all privileges'), false, false);
    echo '<br />' . "\n";
    echo PMA_getCheckbox('createdb-2', __('Grant all privileges on wildcard name (username\\_%)'), false, false);
    echo '<br />' . "\n";

    if (! empty($dbname) ) {
        echo PMA_getCheckbox('createdb-3', sprintf(__('Grant all privileges on database &quot;%s&quot;'), htmlspecialchars($dbname)), true, false);
        echo '<input type="hidden" name="dbname" value="' . htmlspecialchars($dbname) . '" />' . "\n";
        echo '<br />' . "\n";
    }

    echo '</fieldset>' . "\n";
    PMA_displayPrivTable('*', '*', false);
    echo '    <fieldset id="fieldset_add_user_footer" class="tblFooters">' . "\n"
       . '        <input type="submit" name="adduser_submit" value="' . __('Go') . '" />' . "\n"
       . '    </fieldset>' . "\n"
       . '</form>' . "\n";
} else {
    // check the privileges for a particular database.
    $user_form = '<form id="usersForm" action="server_privileges.php"><fieldset>' . "\n"
       . '<legend>' . "\n"
       . PMA_getIcon('b_usrcheck.png')
       . '    ' . sprintf(__('Users having access to &quot;%s&quot;'), '<a href="' . $GLOBALS['cfg']['DefaultTabDatabase'] . '?' . PMA_generate_common_url($checkprivs) . '">' .  htmlspecialchars($checkprivs) . '</a>') . "\n"
       . '</legend>' . "\n"
       . '<table id="dbspecificuserrights" class="data">' . "\n"
       . '<thead>' . "\n"
       . '    <tr><th>' . __('User') . '</th>' . "\n"
       . '        <th>' . __('Host') . '</th>' . "\n"
            }
            echo '</fieldset>' . "\n";
            echo '<fieldset class="tblFooters">' . "\n" . '    <input type="submit" value="' . $GLOBALS['strGo'] . '" />' . '</fieldset>' . "\n" . '</form>' . "\n";
        }
        if (empty($dbname) && !$user_does_not_exists) {
            echo '<form action="server_privileges.php" method="post" onsubmit="return checkPassword(this);">' . "\n" . PMA_generate_common_hidden_inputs('', '', 3) . '<input type="hidden" name="username" value="' . htmlspecialchars($username) . '" />' . "\n" . '<input type="hidden" name="hostname" value="' . htmlspecialchars($hostname) . '" />' . "\n" . '<fieldset id="fieldset_change_password">' . "\n" . '    <legend>' . $GLOBALS['strChangePassword'] . '</legend>' . "\n" . '    <table class="data">' . "\n" . '    <tr class="odd">' . "\n" . '        <td><input type="radio" name="nopass" value="1" id="radio_nopass_1" onclick="pma_pw.value=\'\'; pma_pw2.value=\'\';" /></td>' . "\n" . '        <td colspan="2"><label for="radio_nopass_1">' . $GLOBALS['strNoPassword'] . '</label></td>' . "\n" . '    </tr>' . "\n" . '    <tr class="even">' . "\n" . '        <td><input type="radio" name="nopass" value="0" id="radio_nopass_0" onclick="document.getElementById(\'pw_pma_pw\').focus();" /></td>' . "\n" . '        <td><label for="radio_nopass_0">' . $GLOBALS['strPassword'] . ':</label></td>' . "\n" . '        <td><input type="password" name="pma_pw" id="pw_pma_pw" onchange="nopass[1].checked = true;" /></td>' . "\n" . '    </tr>' . "\n" . '    <tr class="odd">' . "\n" . '        <td></td>' . "\n" . '        <td><label for="pw_pma_pw2">' . $GLOBALS['strReType'] . ':</label></td>' . "\n" . '        <td><input type="password" name="pma_pw2" id="pw_pma_pw2" onchange="nopass[1].checked = true;" /></td>' . "\n" . '    </tr>' . "\n" . '    </table>' . "\n" . '</fieldset>' . "\n" . '<fieldset id="fieldset_change_password_footer" class="tblFooters">' . "\n" . '    <input type="submit" name="change_pw" value="' . $GLOBALS['strGo'] . '" />' . "\n" . '</fieldset>' . "\n" . '</form>' . "\n" . '<form action="server_privileges.php" method="post" onsubmit="return checkPassword(this);">' . "\n" . PMA_generate_common_hidden_inputs('', '', 3) . '<input type="hidden" name="old_username" value="' . htmlspecialchars($username) . '" />' . "\n" . '<input type="hidden" name="old_hostname" value="' . htmlspecialchars($hostname) . '" />' . "\n" . '<fieldset id="fieldset_change_copy_user">' . "\n" . '    <legend>' . $GLOBALS['strChangeCopyUser'] . '</legend>' . "\n";
            PMA_displayLoginInformationFields('change', 3);
            echo '    <fieldset>' . "\n" . '        <legend>' . $GLOBALS['strChangeCopyMode'] . '</legend>' . "\n" . '        <input type="radio" name="mode" value="4" id="radio_mode_4" checked="checked" /><label for="radio_mode_4">' . "\n" . '            ' . $GLOBALS['strChangeCopyModeCopy'] . "\n" . '        </label><br />' . "\n" . '        <input type="radio" name="mode" value="1" id="radio_mode_1" /><label for="radio_mode_1">' . "\n" . '            ' . $GLOBALS['strChangeCopyModeJustDelete'] . "\n" . '        </label><br />' . "\n" . '        <input type="radio" name="mode" value="2" id="radio_mode_2" /><label for="radio_mode_2">' . "\n" . '            ' . $GLOBALS['strChangeCopyModeRevoke'] . "\n" . '        </label><br />' . "\n" . '        <input type="radio" name="mode" value="3" id="radio_mode_3" /><label for="radio_mode_3">' . "\n" . '            ' . $GLOBALS['strChangeCopyModeDeleteAndReload'] . "\n" . '        </label>' . "\n" . '    </fieldset>' . "\n" . '</fieldset>' . "\n" . '<fieldset id="fieldset_change_copy_user_footer" class="tblFooters">' . "\n" . '    <input type="submit" name="change_copy" value="' . $GLOBALS['strGo'] . '" />' . "\n" . '</fieldset>' . "\n" . '</form>' . "\n";
        }
    }
} elseif (!empty($adduser)) {
    // Add a new user
    $GLOBALS['url_query'] .= '&amp;adduser=1';
    echo '<h2>' . "\n" . ($GLOBALS['cfg']['PropertiesIconic'] ? '<img class="icon" src="' . $pmaThemeImage . 'b_usradd.png" width="16" height="16" alt="" />' : '') . '    ' . $GLOBALS['strAddUser'] . "\n" . '</h2>' . "\n" . '<form name="usersForm" id="usersForm" action="server_privileges.php" method="post" onsubmit="return checkAddUser(this);">' . "\n" . PMA_generate_common_hidden_inputs('', '', 1);
    PMA_displayLoginInformationFields('new', 2);
    PMA_displayPrivTable('*', '*', FALSE, 1);
    echo '    <fieldset id="fieldset_add_user_footer" class="tblFooters">' . "\n" . '        <input type="submit" name="adduser_submit" value="' . $GLOBALS['strGo'] . '" />' . "\n" . '    </fieldset>' . "\n" . '</form>' . "\n";
} else {
    // check the privileges for a particular database.
    echo '<table id="tablespecificuserrights" class="data">' . "\n" . '<caption class="tblHeaders">' . "\n" . ($GLOBALS['cfg']['PropertiesIconic'] ? '            <img class="icon" src="' . $pmaThemeImage . 'b_usrcheck.png" width="16" height="16" alt="" />' . "\n" : '') . '    ' . sprintf($GLOBALS['strUsersHavingAccessToDb'], '<a href="' . $GLOBALS['cfg']['DefaultTabDatabase'] . '?' . PMA_generate_common_url($checkprivs) . '">' . htmlspecialchars($checkprivs) . '</a>') . "\n" . '</caption>' . "\n" . '<thead>' . "\n" . '    <tr><th>' . $GLOBALS['strUser'] . '</th>' . "\n" . '        <th>' . $GLOBALS['strHost'] . '</th>' . "\n" . '        <th>' . $GLOBALS['strType'] . '</th>' . "\n" . '        <th>' . $GLOBALS['strPrivileges'] . '</th>' . "\n" . '        <th>' . $GLOBALS['strGrantOption'] . '</th>' . "\n" . '        <th>' . $GLOBALS['strAction'] . '</th>' . "\n" . '    </tr>' . "\n" . '<t/head>' . "\n" . '<tbody>' . "\n";
    $odd_row = TRUE;
    unset($row);
    unset($row1);
    unset($row2);
    // now, we build the table...
    if (PMA_MYSQL_INT_VERSION >= 40000) {
        // Starting with MySQL 4.0.0, we may use UNION SELECTs and this makes
        // the job much easier here!
        $no = PMA_convert_using('N', 'quoted');
        $list_of_privileges = PMA_convert_using('Select_priv') . ' AS Select_priv, ' . PMA_convert_using('Insert_priv') . ' AS Insert_priv, ' . PMA_convert_using('Update_priv') . ' AS Update_priv, ' . PMA_convert_using('Delete_priv') . ' AS Delete_priv, ' . PMA_convert_using('Create_priv') . ' AS Create_priv, ' . PMA_convert_using('Drop_priv') . ' AS Drop_priv, ' . PMA_convert_using('Grant_priv') . ' AS Grant_priv, ' . PMA_convert_using('References_priv') . ' AS References_priv';
        $list_of_compared_privileges = PMA_convert_using('Select_priv') . ' = ' . $no . ' AND ' . PMA_convert_using('Insert_priv') . ' = ' . $no . ' AND ' . PMA_convert_using('Update_priv') . ' = ' . $no . ' AND ' . PMA_convert_using('Delete_priv') . ' = ' . $no . ' AND ' . PMA_convert_using('Create_priv') . ' = ' . $no . ' AND ' . PMA_convert_using('Drop_priv') . ' = ' . $no . ' AND ' . PMA_convert_using('Grant_priv') . ' = ' . $no . ' AND ' . PMA_convert_using('References_priv') . ' = ' . $no;