3 // vim: expandtab sw=4 ts=4 sts=4:
7 * Gets some core libraries
9 require('./libraries/grab_globals.lib.php3');
10 require('./libraries/common.lib.php3');
14 * Displays an error message and exits if the user isn't allowed to use this
17 if (!$cfg['ShowChgPassword']) {
18 $cfg['ShowChgPassword'] = @PMA_mysql_query
('USE mysql', $userlink);
20 if ($cfg['Server']['auth_type'] == 'config' ||
!$cfg['ShowChgPassword']) {
21 include('./header.inc.php3');
22 echo '<p><b>' . $strError . '</b></p>' . "\n";
23 echo '<p> ' . $strNoRights . '</p>' . "\n";
24 include('./footer.inc.php3');
30 * If the "change password" form has been submitted, checks for valid values
31 * and submit the query or logout
36 if ($nopass == 0 && isset($pma_pw) && isset($pma_pw2)) {
37 if ($pma_pw != $pma_pw2) {
38 $error_msg = $strPasswordNotSame;
40 if (empty($pma_pw) ||
empty($pma_pw2)) {
41 $error_msg = $strPasswordEmpty;
45 // here $nopass could be == 1
46 if (empty($error_msg)) {
48 // Defines the url to return to in case of error in the sql statement
49 $common_url_query = PMA_generate_common_url();
51 $err_url = 'user_password.php3?' . $common_url_query;
53 $sql_query = 'SET password = ' . (($pma_pw == '') ?
'\'\'' : 'PASSWORD(\'' . ereg_replace('.', '*', $pma_pw) . '\')');
54 $local_query = 'SET password = ' . (($pma_pw == '') ?
'\'\'' : 'PASSWORD(\'' . PMA_sqlAddslashes($pma_pw) . '\')');
55 $result = @PMA_mysql_query
($local_query) or PMA_mysqlDie('', '', FALSE, $err_url);
57 // Changes password cookie if required
58 if ($cfg['Server']['auth_type'] == 'cookie') {
59 setcookie('pma_cookie_password', $pma_pw, 0, $cookie_path, '', $is_https);
61 // For http auth. mode, the "back" link will also enforce new
63 $http_logout = ($cfg['Server']['auth_type'] == 'http')
64 ?
'&old_usr=relog'
68 include('./header.inc.php3');
69 echo '<h1>' . $strChangePassword . '</h1>' . "\n\n";
71 PMA_showMessage($strUpdateProfileMessage);
73 <a href
="index.php3?<?php echo $common_url_query . $http_logout; ?>" target
="_parent">
74 <b
><?php
echo $strBack; ?
></b
></a
>
82 * If the "change password" form hasn't been submitted or the values submitted
83 * aren't valid -> displays the form
86 $js_to_run = 'user_details.js';
87 require('./header.inc.php3');
88 echo '<h1>' . $strChangePassword . '</h1>' . "\n\n";
90 // Displays an error message if required
91 if (!empty($error_msg)) {
92 echo '<p><b>' . $strError . ' : ' . $error_msg . '</b></p>' . "\n";
95 // loic1: autocomplete feature of IE kills the "onchange" event handler and it
96 // must be replaced by the "onpropertychange" one in this case
97 $chg_evt_handler = (PMA_USR_BROWSER_AGENT
== 'IE' && PMA_USR_BROWSER_VER
>= 5)
103 <form method
="post" action
="./user_password.php3" name
="chgPassword" onsubmit
="return checkPassword(this)">
104 <?php
echo PMA_generate_common_hidden_inputs(); ?
>
108 <input type
="radio" name
="nopass" value
="1" onclick
="pma_pw.value = ''; pma_pw2.value = ''; this.checked = true" />
109 <?php
echo $GLOBALS['strNoPassword'] . "\n"; ?
>
114 <input type
="radio" name
="nopass" value
="0" checked
="checked " />
115 <?php
echo $GLOBALS['strPassword']; ?
> 
;: 
;
118 <input type
="password" name
="pma_pw" size
="10" class="textfield" <?php
echo $chg_evt_handler; ?
>="nopass[1].checked = true" />
120 <?php
echo $GLOBALS['strReType']; ?
> 
;: 
;
121 <input type
="password" name
="pma_pw2" size
="10" class="textfield" <?php
echo $chg_evt_handler; ?
>="nopass[1].checked = true" />
125 <td colspan
="2"> 
;</td
>
129 <input type
="submit" value
="<?php echo($strChange); ?>" />
137 * Displays the footer
140 require('./footer.inc.php3');