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

📄 cookie.auth.lib.php

📁 WEBGAME源码,有架设说明,只是非常简单
💻 PHP
📖 第 1 页 / 共 2 页
字号:
<?php/* $Id: cookie.auth.lib.php,v 2.34.2.1 2005/11/21 12:03:45 nijel Exp $ */// 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;}// Gets the default font sizesPMA_setFontSizes();// timestamp for login timeout$current_time  = time();// Uses faster mcrypt library if available// (Note: mcrypt.lib.php needs $cookie_path and $is_https)// TODO: try to load mcrypt?if (function_exists('mcrypt_encrypt')) {    require_once('./libraries/mcrypt.lib.php');} else {    require_once('./libraries/blowfish.php');}/** * Sorts available languages by their true names * * @param   array   the array to be sorted * @param   mixed   a required parameter * * @return  the sorted array * * @access  private */function PMA_cookie_cmp(&$a, $b){    return (strcmp($a[1], $b[1]));} // end of the 'PMA_cmp()' function/** * 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 $right_font_family, $font_size, $font_bigger;    global $cfg, $available_languages;    global $lang, $server, $convcharset;    global $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'];        }        else if (!empty($_COOKIE) && isset($_COOKIE['pma_cookie_servername-' . $server])) {            $default_server = $_COOKIE['pma_cookie_servername-' . $server];        }        if (isset($default_server) && get_magic_quotes_gpc()) {            $default_server = stripslashes($default_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']);    require_once('./libraries/select_theme.lib.php');    // 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 language="javascript" type="text/javascript"><!--// show login form in top frameif (top != self) {    window.top.location.href=location;}//--></script></head><body bgcolor="<?php echo $cfg['RightBgColor']; ?>"><?php include('./config.header.inc.php'); ?><center><a href="http://www.phpmyadmin.net" target="_blank"><?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><h2><?php echo sprintf($GLOBALS['strWelcome'], ' phpMyAdmin ' . PMA_VERSION); ?></h2>    <?php    // Displays the languages form    if (empty($cfg['Lang'])) {        echo "\n";        ?><!-- Language selection --><form method="post" action="index.php" target="_top">    <?php    if (isset($GLOBALS['db'])) {        echo '            <input type="hidden" name="db" value="' . htmlspecialchars($GLOBALS['db']) . '" />' . "\n";    }    if (isset($GLOBALS['table'])) {        echo '            <input type="hidden" name="table" value="' . htmlspecialchars($GLOBALS['table']) . '" />' . "\n";    }    ?>    <input type="hidden" name="server" value="<?php echo $server; ?>" />    <table border="0" cellpadding="3" cellspacing="0">        <tr>            <td><b>Language:&nbsp;</b></td>            <td>    <select name="lang" dir="ltr" onchange="this.form.submit();">        <?php        echo "\n";        uasort($available_languages, 'PMA_cookie_cmp');        foreach ($available_languages AS $id => $tmplang) {            $lang_name = ucfirst(substr(strrchr($tmplang[0], '|'), 1));            if ($lang == $id) {                $selected = ' selected="selected"';            } else {                $selected = '';            }            echo '        ';            echo '<option value="' . $id . '"' . $selected . '>' . $lang_name . ' (' . $id . ')</option>' . "\n";        } // end while        ?>    </select>    <input type="submit" value="<?php echo $GLOBALS['strGo']; ?>" />            </td>        </tr>        <?php    }    echo "\n\n";    echo '        </table>' . "\n"       . '    </form>' . "\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        include('./config.footer.inc.php');        echo '    </body>' . "\n"           . '</html>';        exit();    }?>    </table></form><?php    if ( !empty($conn_error)) {        echo '<div class="error"><h1>' . $GLOBALS['strError'] . '</h1>' . "\n";        echo $conn_error . '</div>' . "\n";    }?><br /><!-- Login form --><form method="post" action="index.php" name="login_form"<?php echo $autocomplete; ?> target="_top">    <table cellpadding="3" cellspacing="0">      <tr>        <th align="left" colspan="2" class="tblHeaders" style="font-size: 14px; font-weight: bold;"><?php echo $GLOBALS['strLogin']; ?></th>    </tr>    <tr>        <td align="center" colspan="2" bgcolor="<?php echo $GLOBALS['cfg']['BgcolorOne']; ?>"><?php echo '(' . $GLOBALS['strCookiesRequired'] . ')'; ?></td>    </tr><?php if ($GLOBALS['cfg']['AllowArbitraryServer']) { ?>    <tr>        <td align="right" bgcolor="<?php echo $GLOBALS['cfg']['BgcolorOne']; ?>"><b><?php echo $GLOBALS['strLogServer']; ?>:&nbsp;</b></td>        <td align="<?php echo $cell_align; ?>" bgcolor="<?php echo $GLOBALS['cfg']['BgcolorOne']; ?>">            <input type="text" name="pma_servername" value="<?php echo (isset($default_server) ? htmlspecialchars($default_server) : ''); ?>" size="24" class="textfield" onfocus="this.select()" />        </td>    </tr><?php } ?>    <tr>        <td align="right" bgcolor="<?php echo $GLOBALS['cfg']['BgcolorOne']; ?>"><b><?php echo $GLOBALS['strLogUsername']; ?>&nbsp;</b></td>        <td align="<?php echo $cell_align; ?>" bgcolor="<?php echo $GLOBALS['cfg']['BgcolorOne']; ?>">            <input type="text" name="pma_username" value="<?php echo (isset($default_user) ? htmlspecialchars($default_user) : ''); ?>" size="24" class="textfield" onfocus="this.select()" />        </td>    </tr>    <tr>        <td align="right" bgcolor="<?php echo $GLOBALS['cfg']['BgcolorOne']; ?>"><b><?php echo $GLOBALS['strLogPassword']; ?>&nbsp;</b></td>        <td align="<?php echo $cell_align; ?>" bgcolor="<?php echo $GLOBALS['cfg']['BgcolorOne']; ?>">            <input type="password" name="pma_password" value="" size="24" class="textfield" onfocus="this.select()" />        </td>    </tr>    <?php    if (count($cfg['Servers']) > 1) {        echo "\n";        ?>    <tr>        <td align="right" bgcolor="<?php echo $GLOBALS['cfg']['BgcolorOne']; ?>"><b><?php echo $GLOBALS['strServerChoice']; ?>:&nbsp;</b></td>        <td align="<?php echo $cell_align; ?>" bgcolor="<?php echo $GLOBALS['cfg']['BgcolorOne']; ?>">            <select name="server"            <?php            if ($GLOBALS['cfg']['AllowArbitraryServer']) {                echo ' onchange="document.forms[\'login_form\'].elements[\'pma_servername\'].value = \'\'" ';            }            ?>            >        <?php        echo "\n";        // Displays the MySQL servers choice        foreach ($cfg['Servers'] AS $key => $val) {            if (!empty($val['host'])) {                echo '                <option value="' . $key . '"';                if (!empty($server) && ($server == $key)) {                    echo ' selected="selected"';                }                echo '>';                if ($val['verbose'] != '') {                    echo htmlspecialchars($val['verbose']);                } else {                    echo htmlspecialchars($val['host']);                    if (!empty($val['port'])) {                        echo ':' . $val['port'];                    }                    // loic1: skip this because it's not a so good idea to                    //        display sockets used to everybody                    // if (!empty($val['socket']) && PMA_PHP_INT_VERSION >= 30010) {                    //     echo ':' . $val['socket'];                    // }                }                // loic1: if 'only_db' is an array and there is more than one                //        value, displaying such informations may not be a so                //        good idea                if (!empty($val['only_db'])) {                    echo ' - ' . (is_array($val['only_db']) ? implode(', ', $val['only_db']) : $val['only_db']);                }                if (!empty($val['user']) && ($val['auth_type'] == 'basic')) {                    echo '  (' . $val['user'] . ')';                }                echo '&nbsp;</option>' . "\n";            } // end if (!empty($val['host']))        } // end while        ?>            </select>        </td>    </tr>        <?php    } // end if (server choice)    echo "\n";    ?>    <tr>        <td colspan="2" align="right">    <?php    if (count($cfg['Servers']) == 1) {        echo '    <input type="hidden" name="server" value="' . $server . '" />';

⌨️ 快捷键说明

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