Documentation TYPO3 par Ameos

cookie.auth.lib.php

00001 <?php
00002 /* $Id: cookie.auth.lib.php,v 2.26.2.1 2005/09/07 07:20:01 nijel Exp $ */
00003 // vim: expandtab sw=4 ts=4 sts=4:
00004 
00005 // +--------------------------------------------------------------------------+
00006 // | Set of functions used to run cookie based authentication.                |
00007 // | Thanks to Piotr Roszatycki <d3xter at users.sourceforge.net> and         |
00008 // | Dan Wilson who built this patch for the Debian package.                  |
00009 // +--------------------------------------------------------------------------+
00010 
00011 
00012 if (!isset($coming_from_common)) {
00013    exit;
00014 }
00015 
00016 // Gets the default font sizes
00017 PMA_setFontSizes();
00018 
00019 // timestamp for login timeout
00020 $current_time  = time();
00021 
00022 // Uses faster mcrypt library if available
00023 // (Note: mcrypt.lib.php needs $cookie_path and $is_https)
00024 // TODO: try to load mcrypt?
00025 if (function_exists('mcrypt_encrypt')) {
00026     require_once('./libraries/mcrypt.lib.php');
00027 } else {
00028     require_once('./libraries/blowfish.php');
00029 }
00030 
00041 function PMA_cookie_cmp(&$a, $b)
00042 {
00043     return (strcmp($a[1], $b[1]));
00044 } // end of the 'PMA_cmp()' function
00045 
00046 
00065 function PMA_auth()
00066 {
00067     global $right_font_family, $font_size, $font_bigger;
00068     global $cfg, $available_languages;
00069     global $lang, $server, $convcharset;
00070     global $conn_error;
00071 
00072     // Tries to get the username from cookie whatever are the values of the
00073     // 'register_globals' and the 'variables_order' directives if last login
00074     // should be recalled, else skip the IE autocomplete feature.
00075     if ($cfg['LoginCookieRecall']) {
00076         // username
00077         // do not try to use pma_cookie_username as it was encoded differently
00078         // in previous versions and would produce an undefined offset in blowfish
00079         if (!empty($_COOKIE) && isset($_COOKIE['pma_cookie_username-' . $server])) {
00080             $default_user = $_COOKIE['pma_cookie_username-' . $server];
00081         }
00082         $decrypted_user = isset($default_user) ? PMA_blowfish_decrypt($default_user, $GLOBALS['cfg']['blowfish_secret']) : '';
00083         $pos = strrpos($decrypted_user, ':');
00084         $default_user = substr($decrypted_user, 0, $pos);
00085         // server name
00086         if (!empty($GLOBALS['pma_cookie_servername'])) {
00087             $default_server = $GLOBALS['pma_cookie_servername'];
00088         }
00089         else if (!empty($_COOKIE) && isset($_COOKIE['pma_cookie_servername-' . $server])) {
00090             $default_server = $_COOKIE['pma_cookie_servername-' . $server];
00091         }
00092         if (isset($default_server) && get_magic_quotes_gpc()) {
00093             $default_server = stripslashes($default_server);
00094         }
00095 
00096         $autocomplete     = '';
00097     }
00098     else {
00099         $default_user     = '';
00100         $autocomplete     = ' autocomplete="off"';
00101     }
00102 
00103     $cell_align = ($GLOBALS['text_dir'] == 'ltr') ? 'left' : 'right';
00104 
00105     // Defines the charset to be used
00106     header('Content-Type: text/html; charset=' . $GLOBALS['charset']);
00107 
00108     require_once('./libraries/select_theme.lib.php');
00109     // Defines the "item" image depending on text direction
00110     $item_img = $GLOBALS['pmaThemeImage'] . 'item_ltr.png';
00111 
00112     // Title
00113     ?>
00114 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
00115     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
00116 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $GLOBALS['available_languages'][$GLOBALS['lang']][2]; ?>" lang="<?php echo $GLOBALS['available_languages'][$GLOBALS['lang']][2]; ?>" dir="<?php echo $GLOBALS['text_dir']; ?>">
00117 
00118 <head>
00119 <title>phpMyAdmin <?php echo PMA_VERSION; ?></title>
00120 <meta http-equiv="Content-Type" content="text/html; charset=<?php echo $GLOBALS['charset']; ?>" />
00121 <script language="JavaScript" type="text/javascript">
00122 <!--
00123     /* added 2004-06-10 by Michael Keck
00124      *       we need this for Backwards-Compatibility and resolving problems
00125      *       with non DOM browsers, which may have problems with css 2 (like NC 4)
00126     */
00127     var isDOM      = (typeof(document.getElementsByTagName) != 'undefined'
00128                       && typeof(document.createElement) != 'undefined')
00129                    ? 1 : 0;
00130     var isIE4      = (typeof(document.all) != 'undefined'
00131                       && parseInt(navigator.appVersion) >= 4)
00132                    ? 1 : 0;
00133     var isNS4      = (typeof(document.layers) != 'undefined')
00134                    ? 1 : 0;
00135     var capable    = (isDOM || isIE4 || isNS4)
00136                    ? 1 : 0;
00137     // Uggly fix for Opera and Konqueror 2.2 that are half DOM compliant
00138     if (capable) {
00139         if (typeof(window.opera) != 'undefined') {
00140             var browserName = ' ' + navigator.userAgent.toLowerCase();
00141             if ((browserName.indexOf('konqueror 7') == 0)) {
00142                 capable = 0;
00143             }
00144         } else if (typeof(navigator.userAgent) != 'undefined') {
00145             var browserName = ' ' + navigator.userAgent.toLowerCase();
00146             if ((browserName.indexOf('konqueror') > 0) && (browserName.indexOf('konqueror/3') == 0)) {
00147                 capable = 0;
00148             }
00149         } // end if... else if...
00150     } // end if
00151     document.writeln('<link rel="stylesheet" type="text/css" href="<?php echo defined('PMA_PATH_TO_BASEDIR') ? PMA_PATH_TO_BASEDIR : './'; ?>css/phpmyadmin.css.php?lang=<?php echo $GLOBALS['available_languages'][$GLOBALS['lang']][2]; ?>&amp;js_frame=right&amp;js_isDOM=' + isDOM + '" />');
00152 //-->
00153 </script>
00154 <noscript>
00155     <link rel="stylesheet" type="text/css" href="<?php echo defined('PMA_PATH_TO_BASEDIR') ? PMA_PATH_TO_BASEDIR : './'; ?>css/phpmyadmin.css.php?lang=<?php echo $GLOBALS['available_languages'][$GLOBALS['lang']][2]; ?>&amp;js_frame=right" />
00156 </noscript>
00157 
00158 <base href="<?php echo $cfg['PmaAbsoluteUri']; ?>" />
00159 <script language="javascript" type="text/javascript">
00160 <!--
00161 // show login form in top frame
00162 if (top != self) {
00163     window.top.location.href=location;
00164 }
00165 //-->
00166 </script>
00167 </head>
00168 
00169 <body bgcolor="<?php echo $cfg['RightBgColor']; ?>">
00170 
00171 <?php include('./config.header.inc.php'); ?>
00172 
00173 <center>
00174 <a href="http://www.phpmyadmin.net" target="_blank"><?php
00175     $logo_image = $GLOBALS['pmaThemeImage'] . 'logo_right.png';
00176     if (@file_exists($logo_image)) {
00177         echo '<img src="' . $logo_image . '" id="imLogo" name="imLogo" alt="phpMyAdmin" border="0" />';
00178     } else {
00179         echo '<img name="imLogo" id="imLogo" src="' . $GLOBALS['pmaThemeImage'] . 'pma_logo.png' . '" '
00180            . 'border="0" width="88" height="31" alt="phpMyAdmin" />';
00181     }
00182 ?></a>
00183 <h2><?php echo sprintf($GLOBALS['strWelcome'], ' phpMyAdmin ' . PMA_VERSION); ?></h2>
00184     <?php
00185     // Displays the languages form
00186     if (empty($cfg['Lang'])) {
00187         echo "\n";
00188         ?>
00189 <!-- Language selection -->
00190 <form method="post" action="index.php" target="_top">
00191     <input type="hidden" name="server" value="<?php echo $server; ?>" />
00192     <table border="0" cellpadding="3" cellspacing="0">
00193         <tr>
00194             <td><b>Language:&nbsp;</b></td>
00195             <td>
00196     <select name="lang" dir="ltr" onchange="this.form.submit();">
00197         <?php
00198         echo "\n";
00199 
00200         uasort($available_languages, 'PMA_cookie_cmp');
00201         foreach ($available_languages AS $id => $tmplang) {
00202             $lang_name = ucfirst(substr(strrchr($tmplang[0], '|'), 1));
00203             if ($lang == $id) {
00204                 $selected = ' selected="selected"';
00205             } else {
00206                 $selected = '';
00207             }
00208             echo '        ';
00209             echo '<option value="' . $id . '"' . $selected . '>' . $lang_name . ' (' . $id . ')</option>' . "\n";
00210         } // end while
00211         ?>
00212     </select>
00213     <input type="submit" value="<?php echo $GLOBALS['strGo']; ?>" />
00214             </td>
00215         </tr>
00216         <?php
00217     }
00218     echo "\n\n";
00219 
00220     // Displays the warning message and the login form
00221 
00222     if ($GLOBALS['cfg']['blowfish_secret']=='') {
00223     ?>
00224         <tr><td colspan="2" height="5"></td></tr>
00225         <tr>
00226             <th colspan="2" align="left" class="tblHeadError">
00227                 <div class="errorhead"><?php echo $GLOBALS['strError']; ?></div>
00228             </th>
00229         </tr>
00230         <tr>
00231             <td class="tblError" colspan="2" align="left"><?php echo $GLOBALS['strSecretRequired']; ?></td>
00232         </tr>
00233 <?php
00234         include('./config.footer.inc.php');
00235         echo '        </table>' . "\n"
00236            . '    </form>' . "\n"
00237            . '    </body>' . "\n"
00238            . '</html>';
00239         exit();
00240     }
00241 ?>
00242     </table>
00243 </form>
00244 <br />
00245 <!-- Login form -->
00246 <form method="post" action="index.php" name="login_form"<?php echo $autocomplete; ?> target="_top">
00247     <table cellpadding="3" cellspacing="0">
00248       <tr>
00249         <th align="left" colspan="2" class="tblHeaders" style="font-size: 14px; font-weight: bold;"><?php echo $GLOBALS['strLogin']; ?></th>
00250     </tr>
00251     <tr>
00252         <td align="center" colspan="2" bgcolor="<?php echo $GLOBALS['cfg']['BgcolorOne']; ?>"><?php echo '(' . $GLOBALS['strCookiesRequired'] . ')'; ?></td>
00253     </tr>
00254 <?php if ($GLOBALS['cfg']['AllowArbitraryServer']) { ?>
00255     <tr>
00256         <td align="right" bgcolor="<?php echo $GLOBALS['cfg']['BgcolorOne']; ?>"><b><?php echo $GLOBALS['strLogServer']; ?>:&nbsp;</b></td>
00257         <td align="<?php echo $cell_align; ?>" bgcolor="<?php echo $GLOBALS['cfg']['BgcolorOne']; ?>">
00258             <input type="text" name="pma_servername" value="<?php echo (isset($default_server) ? htmlspecialchars($default_server) : ''); ?>" size="24" class="textfield" onfocus="this.select()" />
00259         </td>
00260     </tr>
00261 <?php } ?>
00262     <tr>
00263         <td align="right" bgcolor="<?php echo $GLOBALS['cfg']['BgcolorOne']; ?>"><b><?php echo $GLOBALS['strLogUsername']; ?>&nbsp;</b></td>
00264         <td align="<?php echo $cell_align; ?>" bgcolor="<?php echo $GLOBALS['cfg']['BgcolorOne']; ?>">
00265             <input type="text" name="pma_username" value="<?php echo (isset($default_user) ? htmlspecialchars($default_user) : ''); ?>" size="24" class="textfield" onfocus="this.select()" />
00266         </td>
00267     </tr>
00268     <tr>
00269         <td align="right" bgcolor="<?php echo $GLOBALS['cfg']['BgcolorOne']; ?>"><b><?php echo $GLOBALS['strLogPassword']; ?>&nbsp;</b></td>
00270         <td align="<?php echo $cell_align; ?>" bgcolor="<?php echo $GLOBALS['cfg']['BgcolorOne']; ?>">
00271             <input type="password" name="pma_password" value="" size="24" class="textfield" onfocus="this.select()" />
00272         </td>
00273     </tr>
00274     <?php
00275     if (count($cfg['Servers']) > 1) {
00276         echo "\n";
00277         ?>
00278     <tr>
00279         <td align="right" bgcolor="<?php echo $GLOBALS['cfg']['BgcolorOne']; ?>"><b><?php echo $GLOBALS['strServerChoice']; ?>:&nbsp;</b></td>
00280         <td align="<?php echo $cell_align; ?>" bgcolor="<?php echo $GLOBALS['cfg']['BgcolorOne']; ?>">
00281             <select name="server"
00282             <?php
00283             if ($GLOBALS['cfg']['AllowArbitraryServer']) {
00284                 echo ' onchange="document.forms[\'login_form\'].elements[\'pma_servername\'].value = \'\'" ';
00285             }
00286             ?>
00287             >
00288         <?php
00289         echo "\n";
00290         // Displays the MySQL servers choice
00291         foreach ($cfg['Servers'] AS $key => $val) {
00292             if (!empty($val['host']) || $val['auth_type'] == 'arbitrary') {
00293                 echo '                <option value="' . $key . '"';
00294                 if (!empty($server) && ($server == $key)) {
00295                     echo ' selected="selected"';
00296                 }
00297                 echo '>';
00298                 if ($val['verbose'] != '') {
00299                     echo $val['verbose'];
00300                 } elseif ($val['auth_type'] == 'arbitrary') {
00301                     echo $GLOBALS['strArbitrary'];
00302                 } else {
00303                     echo $val['host'];
00304                     if (!empty($val['port'])) {
00305                         echo ':' . $val['port'];
00306                     }
00307                     // loic1: skip this because it's not a so good idea to
00308                     //        display sockets used to everybody
00309                     // if (!empty($val['socket']) && PMA_PHP_INT_VERSION >= 30010) {
00310                     //     echo ':' . $val['socket'];
00311                     // }
00312                 }
00313                 // loic1: if 'only_db' is an array and there is more than one
00314                 //        value, displaying such informations may not be a so
00315                 //        good idea
00316                 if (!empty($val['only_db'])) {
00317                     echo ' - ' . (is_array($val['only_db']) ? implode(', ', $val['only_db']) : $val['only_db']);
00318                 }
00319                 if (!empty($val['user']) && ($val['auth_type'] == 'basic')) {
00320                     echo '  (' . $val['user'] . ')';
00321                 }
00322                 echo '&nbsp;</option>' . "\n";
00323             } // end if (!empty($val['host']))
00324         } // end while
00325         ?>
00326             </select>
00327         </td>
00328     </tr>
00329         <?php
00330     } // end if (server choice)
00331     echo "\n";
00332     if (!empty($conn_error)) {
00333         echo '<tr><td colspan="2" height="5"></td></tr>';
00334         echo '<tr><th colspan="2" align="left" class="tblHeadError"><div class="errorhead">' . $GLOBALS['strError'] . '</div></th></tr>' . "\n";
00335         echo '<tr><td colspan="2" align="left" class="tblError">'. $conn_error . '</td></tr>' . "\n";
00336     }
00337     ?>
00338     <tr>
00339         <td colspan="2" align="right">
00340     <?php
00341     if (count($cfg['Servers']) == 1) {
00342         echo '    <input type="hidden" name="server" value="' . $server . '" />';
00343     }
00344     echo "\n";
00345     ?>
00346             <input type="hidden" name="lang" value="<?php echo $lang; ?>" />
00347             <input type="hidden" name="convcharset" value="<?php echo $convcharset; ?>" />
00348     <?php
00349     if (isset($GLOBALS['db'])) {
00350         echo '            <input type="hidden" name="db" value="' . htmlspecialchars($GLOBALS['db']) . '" />' . "\n";
00351     }
00352     ?>
00353             <input type="submit" value="<?php echo $GLOBALS['strLogin']; ?>" id="buttonYes" />
00354         </td>
00355     </tr>
00356     </table>
00357 </form>
00358 </center>
00359 
00360 <script type="text/javascript" language="javascript">
00361 <!--
00362 var uname = document.forms['login_form'].elements['pma_username'];
00363 var pword = document.forms['login_form'].elements['pma_password'];
00364 if (uname.value == '') {
00365     uname.focus();
00366 } else {
00367     pword.focus();
00368 }
00369 //-->
00370 </script>
00371 
00372 <?php include('./config.footer.inc.php'); ?>
00373 
00374 </body>
00375 
00376 </html>
00377     <?php
00378     exit();
00379 
00380     return TRUE;
00381 } // end of the 'PMA_auth()' function
00382 
00383 
00402 function PMA_auth_check()
00403 {
00404     global $PHP_AUTH_USER, $PHP_AUTH_PW, $pma_auth_server;
00405     global $pma_servername, $pma_username, $pma_password, $old_usr, $server;
00406     global $from_cookie;
00407 
00408     // avoid an error in mcrypt
00409     if ($GLOBALS['cfg']['blowfish_secret']=='') {
00410         return FALSE;
00411     }
00412 
00413     // Initialization
00414     $PHP_AUTH_USER = $PHP_AUTH_PW = '';
00415     $from_cookie   = FALSE;
00416     $from_form     = FALSE;
00417 
00418     // The user wants to be logged out -> delete password cookie
00419     if (!empty($old_usr)) {
00420         setcookie('pma_cookie_password-' . $server, '', 0, $GLOBALS['cookie_path'], '' , $GLOBALS['is_https']);
00421     }
00422 
00423     // The user just logged in
00424     else if (!empty($pma_username)) {
00425         $PHP_AUTH_USER = $pma_username;
00426         $PHP_AUTH_PW   = (empty($pma_password)) ? '' : $pma_password;
00427         if ($GLOBALS['cfg']['AllowArbitraryServer']) {
00428             $pma_auth_server = $pma_servername;
00429         }
00430         $from_form     = TRUE;
00431     }
00432 
00433     // At the end, try to set the $PHP_AUTH_USER & $PHP_AUTH_PW variables
00434     // from cookies whatever are the values of the 'register_globals' and
00435     // the 'variables_order' directives
00436     else {
00437         if ($GLOBALS['cfg']['AllowArbitraryServer']) {
00438             // servername
00439             if (!empty($pma_cookie_servername)) {
00440                 $pma_auth_server = $pma_cookie_servername;
00441                 $from_cookie   = TRUE;
00442             }
00443             else if (!empty($_COOKIE) && isset($_COOKIE['pma_cookie_servername-' . $server])) {
00444                 $pma_auth_server = $_COOKIE['pma_cookie_servername-' . $server];
00445                 $from_cookie   = TRUE;
00446             }
00447         }
00448 
00449         // username
00450         if (!empty($_COOKIE) && isset($_COOKIE['pma_cookie_username-' . $server])) {
00451             $PHP_AUTH_USER = $_COOKIE['pma_cookie_username-' . $server];
00452             $from_cookie   = TRUE;
00453         }
00454         $decrypted_user = PMA_blowfish_decrypt($PHP_AUTH_USER, $GLOBALS['cfg']['blowfish_secret']);
00455         $pos = strrpos($decrypted_user, ':');
00456         $PHP_AUTH_USER = substr($decrypted_user, 0, $pos);
00457         $decrypted_time = (int)substr($decrypted_user, $pos + 1);
00458 
00459         // User inactive too long
00460         if ($decrypted_time > 0 && $decrypted_time < $GLOBALS['current_time'] - $GLOBALS['cfg']['LoginCookieValidity']) {
00461             // Display an error message only if the inactivity has lasted
00462             // less than 4 times the timeout value. This is to avoid
00463             // alerting users with a error after "much" time has passed,
00464             // for example next morning.
00465             if ($decrypted_time > $GLOBALS['current_time'] - ($GLOBALS['cfg']['LoginCookieValidity'] * 4)) {
00466                 $GLOBALS['no_activity'] = TRUE;
00467                 PMA_auth_fails();
00468             }
00469             return FALSE;
00470         }
00471 
00472         // password
00473         if (!empty($pma_cookie_password)) {
00474             $PHP_AUTH_PW   = $pma_cookie_password;
00475         }
00476         else if (!empty($_COOKIE) && isset($_COOKIE['pma_cookie_password-' . $server])) {
00477             $PHP_AUTH_PW   = $_COOKIE['pma_cookie_password-' . $server];
00478         }
00479         else {
00480             $from_cookie   = FALSE;
00481         }
00482         $PHP_AUTH_PW = PMA_blowfish_decrypt($PHP_AUTH_PW, $GLOBALS['cfg']['blowfish_secret'] . $decrypted_time);
00483 
00484         if ($PHP_AUTH_PW == "\xff(blank)") {
00485             $PHP_AUTH_PW   = '';
00486         }
00487     }
00488 
00489     // Returns whether we get authentication settings or not
00490     if (!$from_cookie && !$from_form) {
00491         return FALSE;
00492     } elseif ($from_cookie) {
00493         return TRUE;
00494     } else {
00495         // we don't need to strip here, it is done in grab_globals
00496         return TRUE;
00497     }
00498 } // end of the 'PMA_auth_check()' function
00499 
00500 
00516 function PMA_auth_set_user()
00517 {
00518     global $cfg, $server;
00519     global $PHP_AUTH_USER, $PHP_AUTH_PW, $pma_auth_server;
00520     global $from_cookie;
00521 
00522     // Ensures valid authentication mode, 'only_db', bookmark database and
00523     // table names and relation table name are used
00524     if ($cfg['Server']['user'] != $PHP_AUTH_USER) {
00525         $servers_cnt = count($cfg['Servers']);
00526         for ($i = 1; $i <= $servers_cnt; $i++) {
00527             if (isset($cfg['Servers'][$i])
00528                 && ($cfg['Servers'][$i]['host'] == $cfg['Server']['host'] && $cfg['Servers'][$i]['user'] == $PHP_AUTH_USER)) {
00529                 $server        = $i;
00530                 $cfg['Server'] = $cfg['Servers'][$i];
00531                 break;
00532             }
00533         } // end for
00534     } // end if
00535 
00536     $pma_server_changed = FALSE;
00537     if ($GLOBALS['cfg']['AllowArbitraryServer']
00538             && isset($pma_auth_server) && !empty($pma_auth_server)
00539             && ($cfg['Server']['host'] != $pma_auth_server)
00540             ) {
00541         $cfg['Server']['host'] = $pma_auth_server;
00542         $pma_server_changed = TRUE;
00543     }
00544     $cfg['Server']['user']     = $PHP_AUTH_USER;
00545     $cfg['Server']['password'] = $PHP_AUTH_PW;
00546 
00547     // Name and password cookies needs to be refreshed each time
00548     // Duration = one month for username
00549     setcookie('pma_cookie_username-' . $server,
00550         PMA_blowfish_encrypt($cfg['Server']['user'] . ':' . $GLOBALS['current_time'],
00551             $GLOBALS['cfg']['blowfish_secret']),
00552         time() + (60 * 60 * 24 * 30),
00553         $GLOBALS['cookie_path'], '',
00554         $GLOBALS['is_https']);
00555 
00556     // Duration = till the browser is closed for password (we don't want this to be saved)
00557     setcookie('pma_cookie_password-' . $server,
00558         PMA_blowfish_encrypt(!empty($cfg['Server']['password']) ? $cfg['Server']['password'] : "\xff(blank)",
00559             $GLOBALS['cfg']['blowfish_secret'] . $GLOBALS['current_time']),
00560         0,
00561         $GLOBALS['cookie_path'], '',
00562         $GLOBALS['is_https']);
00563 
00564     // Set server cookies if required (once per session) and, in this case, force
00565     // reload to ensure the client accepts cookies
00566     if (!$from_cookie) {
00567         if ($GLOBALS['cfg']['AllowArbitraryServer']) {
00568             if (isset($pma_auth_server) && !empty($pma_auth_server) && $pma_server_changed) {
00569                 // Duration = one month for serverrname
00570                 setcookie('pma_cookie_servername-' . $server,
00571                     $cfg['Server']['host'],
00572                     time() + (60 * 60 * 24 * 30),
00573                     $GLOBALS['cookie_path'], '',
00574                     $GLOBALS['is_https']);
00575             } else {
00576                 // Delete servername cookie
00577                 setcookie('pma_cookie_servername-' . $server, '', 0, $GLOBALS['cookie_path'], '' , $GLOBALS['is_https']);
00578             }
00579         }
00580 
00581         // loic1: workaround against a IIS 5.0 bug
00582         // lem9: here, PMA_sendHeaderLocation() has not yet been defined,
00583         //       so use the workaround
00584         if (empty($GLOBALS['SERVER_SOFTWARE'])) {
00585             if (isset($_SERVER) && !empty($_SERVER['SERVER_SOFTWARE'])) {
00586                 $GLOBALS['SERVER_SOFTWARE'] = $_SERVER['SERVER_SOFTWARE'];
00587             }
00588         } // end if
00589         if (!empty($GLOBALS['SERVER_SOFTWARE']) && $GLOBALS['SERVER_SOFTWARE'] == 'Microsoft-IIS/5.0') {
00590             header('Refresh: 0; url=' . $cfg['PmaAbsoluteUri'] . 'index.php?' . PMA_generate_common_url('', '', '&'));
00591         }
00592         else {
00593             header('Location: ' . $cfg['PmaAbsoluteUri'] . 'index.php?' . PMA_generate_common_url('', '', '&'));
00594         }
00595         exit();
00596     } // end if
00597 
00598     return TRUE;
00599 } // end of the 'PMA_auth_set_user()' function
00600 
00601 
00609 function PMA_auth_fails()
00610 {
00611 global $conn_error, $server;
00612 
00613     // Deletes password cookie and displays the login form
00614     setcookie('pma_cookie_password-' . $server, '', 0, $GLOBALS['cookie_path'], '' , $GLOBALS['is_https']);
00615 
00616     if (isset($GLOBALS['allowDeny_forbidden']) && $GLOBALS['allowDeny_forbidden']) {
00617         $conn_error = $GLOBALS['strAccessDenied'];
00618     } else if (isset($GLOBALS['no_activity']) && $GLOBALS['no_activity']) {
00619         $conn_error = sprintf($GLOBALS['strNoActivity'],$GLOBALS['cfg']['LoginCookieValidity']);
00620     } else if (PMA_DBI_getError()) {
00621         $conn_error = PMA_sanitize(PMA_DBI_getError());
00622     } else if (isset($php_errormsg)) {
00623         $conn_error = $php_errormsg;
00624     } else {
00625         $conn_error = $GLOBALS['strCannotLogin'];
00626     }
00627 
00628     PMA_auth();
00629 
00630     return TRUE;
00631 } // end of the 'PMA_auth_fails()' function
00632 
00633 ?>


Généré par Les experts TYPO3 avec  doxygen 1.4.6