Documentation TYPO3 par Ameos

user_password.php

00001 <?php
00002 /* $Id: user_password.php,v 2.8 2004/11/24 02:44:49 lem9 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_DBI_select_db('mysql');
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>&nbsp;&nbsp;&nbsp;&nbsp;' .  $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         $hashing_function = (PMA_MYSQL_INT_VERSION >= 40102 && !empty($pw_hash) && $pw_hash == 'old' ? 'OLD_' : '')
00051                           . 'PASSWORD';
00052 
00053         $sql_query        = 'SET password = ' . (($pma_pw == '') ? '\'\'' : $hashing_function . '(\'' . preg_replace('@.@s', '*', $pma_pw) . '\')');
00054         $local_query      = 'SET password = ' . (($pma_pw == '') ? '\'\'' : $hashing_function . '(\'' . PMA_sqlAddslashes($pma_pw) . '\')');
00055         $result           = @PMA_DBI_try_query($local_query) or PMA_mysqlDie(PMA_DBI_getError(), $sql_query, FALSE, $err_url);
00056 
00057         // Changes password cookie if required
00058         // Duration = till the browser is closed for password (we don't want this to be saved)
00059         if ($cfg['Server']['auth_type'] == 'cookie') {
00060 
00061             setcookie('pma_cookie_password-' . $server,
00062                PMA_blowfish_encrypt($pma_pw,
00063                $GLOBALS['cfg']['blowfish_secret'] . $GLOBALS['current_time']),
00064                0,
00065                $GLOBALS['cookie_path'], '',
00066                $GLOBALS['is_https']);
00067 
00068         } // end if
00069         // For http auth. mode, the "back" link will also enforce new
00070         // authentication
00071         $http_logout = ($cfg['Server']['auth_type'] == 'http')
00072                      ? '&amp;old_usr=relog'
00073                      : '';
00074 
00075         // Displays the page
00076         require_once('./header.inc.php');
00077         echo '<h1>' . $strChangePassword . '</h1>' . "\n\n";
00078         $show_query = 'y';
00079         PMA_showMessage($strUpdateProfileMessage);
00080         ?>
00081         <a href="index.php?<?php echo $common_url_query . $http_logout; ?>" target="_parent">
00082             <b><?php echo $strBack; ?></b></a>
00083         <?php
00084         exit();
00085     } // end if
00086 } // end if
00087 
00088 
00093 // Loads the headers
00094 $js_to_run = 'user_password.js';
00095 require_once('./header.inc.php');
00096 echo '<h1>' . $strChangePassword . '</h1>' . "\n\n";
00097 
00098 // Displays an error message if required
00099 if (!empty($error_msg)) {
00100     echo '<p><b>' . $strError . ':&nbsp;' . $error_msg . '</b></p>' . "\n";
00101 }
00102 
00103 // loic1: autocomplete feature of IE kills the "onchange" event handler and it
00104 //        must be replaced by the "onpropertychange" one in this case
00105 $chg_evt_handler = (PMA_USR_BROWSER_AGENT == 'IE' && PMA_USR_BROWSER_VER >= 5)
00106                  ? 'onpropertychange'
00107                  : 'onchange';
00108 
00109 // Displays the form
00110 ?>
00111 <form method="post" action="./user_password.php" name="chgPassword" onsubmit="return checkPassword(this)">
00112     <?php echo PMA_generate_common_hidden_inputs(); ?>
00113     <table border="0">
00114     <tr>
00115         <td colspan="2">
00116             <input type="radio" name="nopass" value="1" onclick="pma_pw.value = ''; pma_pw2.value = ''; this.checked = true" />
00117             <?php echo $GLOBALS['strNoPassword'] . "\n"; ?>
00118         </td>
00119     </tr>
00120     <tr>
00121         <td>
00122             <input type="radio" name="nopass" value="0" checked="checked " />
00123             <?php echo $GLOBALS['strPassword']; ?>:&nbsp;
00124         </td>
00125         <td>
00126             <input type="password" name="pma_pw" size="10" class="textfield" <?php echo $chg_evt_handler; ?>="nopass[1].checked = true" />
00127             &nbsp;&nbsp;
00128             <?php echo $GLOBALS['strReType']; ?>:&nbsp;
00129             <input type="password" name="pma_pw2" size="10" class="textfield" <?php echo $chg_evt_handler; ?>="nopass[1].checked = true" />
00130         </td>
00131     </tr>
00132     <?php
00133 
00134 if (PMA_MYSQL_INT_VERSION >= 40102) {
00135     ?>
00136     <tr>
00137         <td>
00138             <?php echo $strPasswordHashing; ?>:
00139         </td>
00140         <td>
00141             <input type="radio" name="pw_hash" id="radio_pw_hash_new" value="new" checked="checked" />
00142             <label for="radio_pw_hash_new">
00143                 MySQL&nbsp;4.1
00144             </label>
00145         </td>
00146     </tr>
00147     <tr>
00148         <td>&nbsp;</td>
00149         <td>
00150             <input type="radio" name="pw_hash" id="radio_pw_hash_old" value="old" />
00151             <label for="radio_pw_hash_old">
00152                 <?php echo $strCompatibleHashing; ?>
00153             </label>
00154         </td>
00155     </tr>
00156     <?php
00157 }
00158 
00159     ?>
00160     <tr>
00161         <td colspan="2">&nbsp;</td>
00162     </tr>
00163     <tr>
00164         <td colspan="2">
00165             <input type="submit" value="<?php echo($strChange); ?>" />
00166         </td>
00167     </tr>
00168     </table>
00169 </form>
00170 
00171 <?php
00175 require_once('./footer.inc.php');
00176 ?>


Généré par Les spécialistes TYPO3 avec  doxygen 1.4.6