[ Index ] |
|
Code source de phpMyAdmin 2.10.3 |
1 <?php 2 /* $Id: user_password.php 9657 2006-11-02 10:51:57Z nijel $ */ 3 // vim: expandtab sw=4 ts=4 sts=4: 4 5 6 /** 7 * Gets some core libraries 8 */ 9 require_once ('./libraries/common.lib.php'); 10 11 /** 12 * Displays an error message and exits if the user isn't allowed to use this 13 * script 14 */ 15 if (!$cfg['ShowChgPassword']) { 16 $cfg['ShowChgPassword'] = PMA_DBI_select_db('mysql'); 17 } 18 if ($cfg['Server']['auth_type'] == 'config' || !$cfg['ShowChgPassword']) { 19 require_once ('./libraries/header.inc.php'); 20 echo '<p><b>' . $strError . '</b></p>' . "\n" 21 . '<p> ' . $strNoRights . '</p>' . "\n"; 22 require_once ('./libraries/footer.inc.php'); 23 } // end if 24 25 26 /** 27 * If the "change password" form has been submitted, checks for valid values 28 * and submit the query or logout 29 */ 30 if (isset($nopass)) { 31 $error_msg = ''; 32 33 if ($nopass == 0 && isset($pma_pw) && isset($pma_pw2)) { 34 if ($pma_pw != $pma_pw2) { 35 $error_msg = $strPasswordNotSame; 36 } 37 if (empty($pma_pw) || empty($pma_pw2)) { 38 $error_msg = $strPasswordEmpty; 39 } 40 } // end if 41 42 // here $nopass could be == 1 43 if (empty($error_msg)) { 44 45 // Defines the url to return to in case of error in the sql statement 46 $common_url_query = PMA_generate_common_url(); 47 48 $err_url = 'user_password.php?' . $common_url_query; 49 $hashing_function = (PMA_MYSQL_INT_VERSION >= 40102 && !empty($pw_hash) && $pw_hash == 'old' ? 'OLD_' : '') 50 . 'PASSWORD'; 51 52 $sql_query = 'SET password = ' . (($pma_pw == '') ? '\'\'' : $hashing_function . '(\'' . preg_replace('@.@s', '*', $pma_pw) . '\')'); 53 $local_query = 'SET password = ' . (($pma_pw == '') ? '\'\'' : $hashing_function . '(\'' . PMA_sqlAddslashes($pma_pw) . '\')'); 54 $result = @PMA_DBI_try_query($local_query) or PMA_mysqlDie(PMA_DBI_getError(), $sql_query, FALSE, $err_url); 55 56 // Changes password cookie if required 57 // Duration = till the browser is closed for password (we don't want this to be saved) 58 if ($cfg['Server']['auth_type'] == 'cookie') { 59 60 PMA_setCookie('pma_cookie_password-' . $server, PMA_blowfish_encrypt($pma_pw, $GLOBALS['cfg']['blowfish_secret'] . $GLOBALS['current_time'])); 61 62 } // end if 63 // For http auth. mode, the "back" link will also enforce new 64 // authentication 65 $http_logout = ($cfg['Server']['auth_type'] == 'http') 66 ? '&old_usr=relog' 67 : ''; 68 69 // Displays the page 70 require_once ('./libraries/header.inc.php'); 71 echo '<h1>' . $strChangePassword . '</h1>' . "\n\n"; 72 $show_query = 'y'; 73 PMA_showMessage($strUpdateProfileMessage); 74 ?> 75 <a href="index.php?<?php echo $common_url_query . $http_logout; ?>" target="_parent"> 76 <b><?php echo $strBack; ?></b></a> 77 <?php 78 exit(); 79 } // end if 80 } // end if 81 82 83 /** 84 * If the "change password" form hasn't been submitted or the values submitted 85 * aren't valid -> displays the form 86 */ 87 // Loads the headers 88 $js_to_run = 'user_password.js'; 89 require_once ('./libraries/header.inc.php'); 90 echo '<h1>' . $strChangePassword . '</h1>' . "\n\n"; 91 92 // Displays an error message if required 93 if (!empty($error_msg)) { 94 echo '<p><b>' . $strError . ': ' . $error_msg . '</b></p>' . "\n"; 95 } 96 97 // loic1: autocomplete feature of IE kills the "onchange" event handler and it 98 // must be replaced by the "onpropertychange" one in this case 99 $chg_evt_handler = (PMA_USR_BROWSER_AGENT == 'IE' && PMA_USR_BROWSER_VER >= 5) 100 ? 'onpropertychange' 101 : 'onchange'; 102 103 // Displays the form 104 ?> 105 <form method="post" action="./user_password.php" name="chgPassword" onsubmit="return checkPassword(this)"> 106 <?php echo PMA_generate_common_hidden_inputs(); ?> 107 <table border="0"> 108 <tr> 109 <td colspan="2"> 110 <input type="radio" name="nopass" value="1" onclick="pma_pw.value = ''; pma_pw2.value = ''; this.checked = true" /> 111 <?php echo $GLOBALS['strNoPassword'] . "\n"; ?> 112 </td> 113 </tr> 114 <tr> 115 <td> 116 <input type="radio" name="nopass" value="0" checked="checked " /> 117 <?php echo $GLOBALS['strPassword']; ?>: 118 </td> 119 <td> 120 <input type="password" name="pma_pw" size="10" class="textfield" <?php echo $chg_evt_handler; ?>="nopass[1].checked = true" /> 121 122 <?php echo $GLOBALS['strReType']; ?>: 123 <input type="password" name="pma_pw2" size="10" class="textfield" <?php echo $chg_evt_handler; ?>="nopass[1].checked = true" /> 124 </td> 125 </tr> 126 <?php 127 128 if (PMA_MYSQL_INT_VERSION >= 40102) { 129 ?> 130 <tr> 131 <td> 132 <?php echo $strPasswordHashing; ?>: 133 </td> 134 <td> 135 <input type="radio" name="pw_hash" id="radio_pw_hash_new" value="new" checked="checked" /> 136 <label for="radio_pw_hash_new"> 137 MySQL 4.1 138 </label> 139 </td> 140 </tr> 141 <tr> 142 <td> </td> 143 <td> 144 <input type="radio" name="pw_hash" id="radio_pw_hash_old" value="old" /> 145 <label for="radio_pw_hash_old"> 146 <?php echo $strCompatibleHashing; ?> 147 </label> 148 </td> 149 </tr> 150 <?php 151 } 152 153 ?> 154 <tr> 155 <td colspan="2"> </td> 156 </tr> 157 <tr> 158 <td colspan="2"> 159 <input type="submit" value="<?php echo($strChange); ?>" /> 160 </td> 161 </tr> 162 </table> 163 </form> 164 165 <?php 166 /** 167 * Displays the footer 168 */ 169 require_once ('./libraries/footer.inc.php'); 170 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Mon Nov 26 15:18:20 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |