2 /* vim: set expandtab sw=4 ts=4 sts=4: */
4 * Displays form for password change
8 if (! defined('PHPMYADMIN')) {
13 * Get HTML for the Change password dialog
15 * @param string $username username
16 * @param string $hostname hostname
18 * @return string html snippet
20 function PMA_getHtmlForChangePassword($username, $hostname)
23 * autocomplete feature of IE kills the "onchange" event handler and it
24 * must be replaced by the "onpropertychange" one in this case
26 $chg_evt_handler = (PMA_USR_BROWSER_AGENT
== 'IE'
27 && PMA_USR_BROWSER_VER
>= 5
28 && PMA_USR_BROWSER_VER
< 7)
32 $is_privileges = basename($_SERVER['SCRIPT_NAME']) === 'server_privileges.php';
34 $html = '<form method="post" id="change_password_form" '
35 . 'action="' . $GLOBALS['PMA_PHP_SELF'] . '" '
36 . 'name="chgPassword" '
38 . ($is_privileges ?
' submenu-item' : '')
41 $html .= PMA_URL_getHiddenInputs();
43 if (strpos($GLOBALS['PMA_PHP_SELF'], 'server_privileges') !== false) {
44 $html .= '<input type="hidden" name="username" '
45 . 'value="' . htmlspecialchars($username) . '" />'
46 . '<input type="hidden" name="hostname" '
47 . 'value="' . htmlspecialchars($hostname) . '" />';
49 $html .= '<fieldset id="fieldset_change_password">'
51 . ($is_privileges ?
' data-submenu-label="' . __('Change password') . '"' : '')
52 . '>' . __('Change password') . '</legend>'
53 . '<table class="data noclick">'
56 . '<input type="radio" name="nopass" value="1" id="nopass_1" '
57 . 'onclick="pma_pw.value = \'\'; pma_pw2.value = \'\'; '
58 . 'this.checked = true" />'
59 . '<label for="nopass_1">' . __('No Password') . '</label>'
62 . '<tr class="even vmiddle">'
64 . '<input type="radio" name="nopass" value="0" id="nopass_0" '
65 . 'onclick="document.getElementById(\'text_pma_pw\').focus();" '
66 . 'checked="checked " />'
67 . '<label for="nopass_0">' . __('Password:') . ' </label>'
70 . '<input type="password" name="pma_pw" id="text_pma_pw" size="10" '
72 . $chg_evt_handler . '="nopass[1].checked = true" />'
73 . ' ' . __('Re-type:') . ' '
74 . '<input type="password" name="pma_pw2" id="text_pma_pw2" size="10" '
76 . $chg_evt_handler . '="nopass[1].checked = true" />'
79 . '<tr class="vmiddle">'
80 . '<td>' . __('Password Hashing:')
83 . '<input type="radio" name="pw_hash" id="radio_pw_hash_new" '
84 . 'value="new" checked="checked" />'
85 . '<label for="radio_pw_hash_new">MySQL 4.1+</label>'
88 . '<tr id="tr_element_before_generate_password">'
91 . '<input type="radio" name="pw_hash" id="radio_pw_hash_old" '
93 . '<label for="radio_pw_hash_old">' . __('MySQL 4.0 compatible')
99 . '<fieldset id="fieldset_change_password_footer" class="tblFooters">'
100 . '<input type="submit" name="change_pw" value="' . __('Go') . '" />'