Documentation TYPO3 par Ameos |
00001 <?php 00002 /* $Id: user_password.php,v 2.3 2003/11/26 22:52:24 rabus Exp $ */ 00003 // vim: expandtab sw=4 ts=4 sts=4: 00004 00005 00009 require_once('./libraries/grab_globals.lib.php'); 00010 require_once('./libraries/common.lib.php'); 00011 00016 if (!$cfg['ShowChgPassword']) { 00017 $cfg['ShowChgPassword'] = @PMA_mysql_query('USE mysql', $userlink); 00018 } 00019 if ($cfg['Server']['auth_type'] == 'config' || !$cfg['ShowChgPassword']) { 00020 require_once('./header.inc.php'); 00021 echo '<p><b>' . $strError . '</b></p>' . "\n" 00022 . '<p> ' . $strNoRights . '</p>' . "\n"; 00023 require_once('./footer.inc.php'); 00024 } // end if 00025 00026 00031 if (isset($nopass)) { 00032 $error_msg = ''; 00033 00034 if ($nopass == 0 && isset($pma_pw) && isset($pma_pw2)) { 00035 if ($pma_pw != $pma_pw2) { 00036 $error_msg = $strPasswordNotSame; 00037 } 00038 if (empty($pma_pw) || empty($pma_pw2)) { 00039 $error_msg = $strPasswordEmpty; 00040 } 00041 } // end if 00042 00043 // here $nopass could be == 1 00044 if (empty($error_msg)) { 00045 00046 // Defines the url to return to in case of error in the sql statement 00047 $common_url_query = PMA_generate_common_url(); 00048 00049 $err_url = 'user_password.php?' . $common_url_query; 00050 00051 $sql_query = 'SET password = ' . (($pma_pw == '') ? '\'\'' : 'PASSWORD(\'' . preg_replace('@.@s', '*', $pma_pw) . '\')'); 00052 $local_query = 'SET password = ' . (($pma_pw == '') ? '\'\'' : 'PASSWORD(\'' . PMA_sqlAddslashes($pma_pw) . '\')'); 00053 $result = @PMA_mysql_query($local_query) or PMA_mysqlDie('', '', FALSE, $err_url); 00054 00055 // Changes password cookie if required 00056 if ($cfg['Server']['auth_type'] == 'cookie') { 00057 setcookie('pma_cookie_password', base64_encode(PMA_blowfish_encrypt($pma_pw,$GLOBALS['cfg']['blowfish_secret'])), 0, $cookie_path, '', $is_https); 00058 } // end if 00059 // For http auth. mode, the "back" link will also enforce new 00060 // authentication 00061 $http_logout = ($cfg['Server']['auth_type'] == 'http') 00062 ? '&old_usr=relog' 00063 : ''; 00064 00065 // Displays the page 00066 require_once('./header.inc.php'); 00067 echo '<h1>' . $strChangePassword . '</h1>' . "\n\n"; 00068 $show_query = 'y'; 00069 PMA_showMessage($strUpdateProfileMessage); 00070 ?> 00071 <a href="index.php?<?php echo $common_url_query . $http_logout; ?>" target="_parent"> 00072 <b><?php echo $strBack; ?></b></a> 00073 <?php 00074 exit(); 00075 } // end if 00076 } // end if 00077 00078 00083 // Loads the headers 00084 $js_to_run = 'user_password.js'; 00085 require_once('./header.inc.php'); 00086 echo '<h1>' . $strChangePassword . '</h1>' . "\n\n"; 00087 00088 // Displays an error message if required 00089 if (!empty($error_msg)) { 00090 echo '<p><b>' . $strError . ' : ' . $error_msg . '</b></p>' . "\n"; 00091 } 00092 00093 // loic1: autocomplete feature of IE kills the "onchange" event handler and it 00094 // must be replaced by the "onpropertychange" one in this case 00095 $chg_evt_handler = (PMA_USR_BROWSER_AGENT == 'IE' && PMA_USR_BROWSER_VER >= 5) 00096 ? 'onpropertychange' 00097 : 'onchange'; 00098 00099 // Displays the form 00100 ?> 00101 <form method="post" action="./user_password.php" name="chgPassword" onsubmit="return checkPassword(this)"> 00102 <?php echo PMA_generate_common_hidden_inputs(); ?> 00103 <table border="0"> 00104 <tr> 00105 <td colspan="2"> 00106 <input type="radio" name="nopass" value="1" onclick="pma_pw.value = ''; pma_pw2.value = ''; this.checked = true" /> 00107 <?php echo $GLOBALS['strNoPassword'] . "\n"; ?> 00108 </td> 00109 </tr> 00110 <tr> 00111 <td> 00112 <input type="radio" name="nopass" value="0" checked="checked " /> 00113 <?php echo $GLOBALS['strPassword']; ?> : 00114 </td> 00115 <td> 00116 <input type="password" name="pma_pw" size="10" class="textfield" <?php echo $chg_evt_handler; ?>="nopass[1].checked = true" /> 00117 00118 <?php echo $GLOBALS['strReType']; ?> : 00119 <input type="password" name="pma_pw2" size="10" class="textfield" <?php echo $chg_evt_handler; ?>="nopass[1].checked = true" /> 00120 </td> 00121 </tr> 00122 <tr> 00123 <td colspan="2"> </td> 00124 </tr> 00125 <tr> 00126 <td colspan="2"> 00127 <input type="submit" value="<?php echo($strChange); ?>" /> 00128 </td> 00129 </tr> 00130 </table> 00131 </form> 00132 00133 <?php 00137 require_once('./footer.inc.php'); 00138 ?>