⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cookie.auth.lib.php

📁 架設ROSE私服必備之物 ROSE數據庫
💻 PHP
📖 第 1 页 / 共 2 页
字号:
<?php/* $Id: cookie.auth.lib.php 9333 2006-08-21 11:55:32Z lem9 $ */// vim: expandtab sw=4 ts=4 sts=4:// +--------------------------------------------------------------------------+// | Set of functions used to run cookie based authentication.                |// | Thanks to Piotr Roszatycki <d3xter at users.sourceforge.net> and         |// | Dan Wilson who built this patch for the Debian package.                  |// +--------------------------------------------------------------------------+if (!isset($coming_from_common)) {   exit;}// timestamp for login timeout$current_time  = time();// Uses faster mcrypt library if available// (Note: mcrypt.lib.php needs $cookie_path and $is_https)if (function_exists('mcrypt_encrypt') || PMA_dl('mcrypt')) {    require_once './libraries/mcrypt.lib.php';} else {    require_once './libraries/blowfish.php';}/** * Displays authentication form * * @global  string    the font face to use * @global  string    the default font size to use * @global  string    the big font size to use * @global  array     the list of servers settings * @global  array     the list of available translations * @global  string    the current language * @global  integer   the current server id * @global  string    the currect charset for MySQL * @global  array     the array of cookie variables if register_globals is *                    off * * @return  boolean   always true (no return indeed) * * @access  public */function PMA_auth(){    global $cfg, $lang, $server, $convcharset, $conn_error;    // Tries to get the username from cookie whatever are the values of the    // 'register_globals' and the 'variables_order' directives if last login    // should be recalled, else skip the IE autocomplete feature.    if ($cfg['LoginCookieRecall'] && !empty($GLOBALS['cfg']['blowfish_secret'])) {        // username        // do not try to use pma_cookie_username as it was encoded differently        // in previous versions and would produce an undefined offset in blowfish        if (!empty($_COOKIE) && isset($_COOKIE['pma_cookie_username-' . $server])) {            $default_user = $_COOKIE['pma_cookie_username-' . $server];        }        $decrypted_user = isset($default_user) ? PMA_blowfish_decrypt($default_user, $GLOBALS['cfg']['blowfish_secret']) : '';        if (!empty($decrypted_user)) {            $pos = strrpos($decrypted_user, ':');            $default_user = substr($decrypted_user, 0, $pos);        } else {            $default_user = '';        }        // server name        if (!empty($GLOBALS['pma_cookie_servername'])) {            $default_server = $GLOBALS['pma_cookie_servername'];        } elseif (!empty($_COOKIE) && isset($_COOKIE['pma_cookie_servername-' . $server])) {            $default_server = $_COOKIE['pma_cookie_servername-' . $server];        }        $autocomplete     = '';    } else {        $default_user     = '';        $autocomplete     = ' autocomplete="off"';    }    $cell_align = ($GLOBALS['text_dir'] == 'ltr') ? 'left' : 'right';    // Defines the charset to be used    header('Content-Type: text/html; charset=' . $GLOBALS['charset']);    // Defines the "item" image depending on text direction    $item_img = $GLOBALS['pmaThemeImage'] . 'item_ltr.png';    /* HTML header */    $page_title = 'phpMyAdmin ' . PMA_VERSION;    require './libraries/header_meta_style.inc.php';    ?><script type="text/javascript" language="javascript">//<![CDATA[// show login form in top frameif (top != self) {    window.top.location.href=location;}//]]></script></head><body class="loginform"><?php if (file_exists('./config.header.inc.php')) {          require('./config.header.inc.php');      } ?><div class="container"><a href="http://www.phpmyadmin.net" target="_blank" class="logo"><?php    $logo_image = $GLOBALS['pmaThemeImage'] . 'logo_right.png';    if (@file_exists($logo_image)) {        echo '<img src="' . $logo_image . '" id="imLogo" name="imLogo" alt="phpMyAdmin" border="0" />';    } else {        echo '<img name="imLogo" id="imLogo" src="' . $GLOBALS['pmaThemeImage'] . 'pma_logo.png' . '" '           . 'border="0" width="88" height="31" alt="phpMyAdmin" />';    }?></a><h1><?phpecho sprintf( $GLOBALS['strWelcome'],    '<bdo dir="ltr" xml:lang="en">phpMyAdmin ' . PMA_VERSION . '</bdo>');?></h1>    <?php    // Show error message    if ( !empty($conn_error)) {        echo '<div class="error"><h1>' . $GLOBALS['strError'] . '</h1>' . "\n";        echo $conn_error . '</div>' . "\n";    }    // Displays the languages form    if (empty($cfg['Lang'])) {        echo "\n";        require_once './libraries/display_select_lang.lib.php';        PMA_select_language(true);    }    echo "\n\n";    // Displays the warning message and the login form    if (empty($GLOBALS['cfg']['blowfish_secret'])) {    ?>        <div class="error"><h1><?php echo $GLOBALS['strError']; ?></h1>            <?php echo $GLOBALS['strSecretRequired']; ?>        </div><?php        echo '</div>' . "\n";        if (file_exists('./config.footer.inc.php')) {            require('./config.footer.inc.php');        }        echo '    </body>' . "\n"           . '</html>';        exit();    }?><br /><!-- Login form --><form method="post" action="index.php" name="login_form"<?php echo $autocomplete; ?> target="_top" class="login">    <fieldset>        <legend><?php echo $GLOBALS['strLogin']; ?></legend><?php if ($GLOBALS['cfg']['AllowArbitraryServer']) { ?>        <div class="item">            <label for="input_servername"><?php echo $GLOBALS['strLogServer']; ?></label>            <input type="text" name="pma_servername" id="input_servername" value="<?php echo (isset($default_server) ? htmlspecialchars($default_server) : ''); ?>" size="24" class="textfield" />        </div><?php } ?>        <div class="item">            <label for="input_username"><?php echo $GLOBALS['strLogUsername']; ?></label>            <input type="text" name="pma_username" id="input_username" value="<?php echo (isset($default_user) ? htmlspecialchars($default_user) : ''); ?>" size="24" class="textfield" />        </div>        <div class="item">            <label for="input_password"><?php echo $GLOBALS['strLogPassword']; ?></label>            <input type="password" name="pma_password" id="input_password" value="" size="24" class="textfield" />        </div>    <?php    if (count($cfg['Servers']) > 1) {        echo "\n";        ?>        <div class="item">            <label for="select_server"><?php echo $GLOBALS['strServerChoice']; ?>:</label>            <select name="server" id="select_server"            <?php            if ($GLOBALS['cfg']['AllowArbitraryServer']) {                echo ' onchange="document.forms[\'login_form\'].elements[\'pma_servername\'].value = \'\'" ';            }            ?>            >        <?php        require_once './libraries/select_server.lib.php';        PMA_select_server(false, false);        ?>            </select>        </div>    <?php    } else {        echo '    <input type="hidden" name="server" value="' . $server . '" />';    } // end if (server choice)    ?>    </fieldset>    <fieldset class="tblFooters">        <input value="<?php echo $GLOBALS['strGo']; ?>" type="submit" />        <input type="hidden" name="lang" value="<?php echo $lang; ?>" />        <input type="hidden" name="convcharset" value="<?php echo $convcharset; ?>" />    <?php    if (!empty($GLOBALS['target'])) {        echo '            <input type="hidden" name="target" value="' . htmlspecialchars($GLOBALS['target']) . '" />' . "\n";    }    if (!empty($GLOBALS['db'])) {        echo '            <input type="hidden" name="db" value="' . htmlspecialchars($GLOBALS['db']) . '" />' . "\n";    }    if (!empty($GLOBALS['table'])) {        echo '            <input type="hidden" name="table" value="' . htmlspecialchars($GLOBALS['table']) . '" />' . "\n";    }    ?>    </fieldset></form><?php// show the "Cookies required" message only if cookies are disabled// (we previously tried to set some cookies)if (empty($_COOKIE)) {    echo '<div class="notice">' . $GLOBALS['strCookiesRequired'] . '</div>' . "\n";}if ( ! empty( $GLOBALS['PMA_errors'] ) && is_array( $GLOBALS['PMA_errors'] ) ) {    foreach ( $GLOBALS['PMA_errors'] as $error ) {        echo '<div class="error">' . $error . '</div>' . "\n";    }}?><script type="text/javascript" language="javascript"><!--var uname = document.forms['login_form'].elements['pma_username'];var pword = document.forms['login_form'].elements['pma_password'];if (uname.value == '') {    uname.focus();} else {    pword.focus();}//--></script></div><?php if (file_exists('./config.footer.inc.php')) {         require('./config.footer.inc.php');      } ?></body></html>    <?php    exit();    return true;} // end of the 'PMA_auth()' function/** * Gets advanced authentication settings * * @global  string    the username if register_globals is on * @global  string    the password if register_globals is on

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -