echo $GLOBALS['cfg']['MainPageIconic'] ? '' : ' - '; echo '<a href="index.php?' . $query_url . '&old_usr='******'" target="_parent"' . ' title="' . $strLogout . '" >' . ($GLOBALS['cfg']['MainPageIconic'] ? '<img class="icon" src="' . $pmaThemeImage . 's_loggoff.png" ' . ' width="16" height="16" alt="' . $strLogout . '" />' : $strLogout) . '</a>' . "\n"; } // end if ($GLOBALS['cfg']['Server']['auth_type'] != 'config' $anchor = 'querywindow.php?' . PMA_generate_common_url($db, $table); if ($GLOBALS['cfg']['MainPageIconic']) { $query_frame_link_text = '<img class="icon" src="' . $pmaThemeImage . 'b_selboard.png"' . ' width="16" height="16" alt="' . $strQueryFrame . '" />'; } else { echo '<br />' . "\n"; $query_frame_link_text = $strQueryFrame; } echo '<a href="' . $anchor . '&no_js=true"' . ' title="' . $strQueryFrame . '"'; echo ' onclick="javascript:if (window.parent.open_querywindow()) return false;"'; echo '>' . $query_frame_link_text . '</a>' . "\n"; } // end if ($server != 0) if ($GLOBALS['cfg']['MainPageIconic']) { echo ' <a href="Documentation.html" target="documentation"' . ' title="' . $strPmaDocumentation . '" >' . '<img class="icon" src="' . $pmaThemeImage . 'b_docs.png" width="16" height="16"' . ' alt="' . $strPmaDocumentation . '" /></a>' . "\n"; echo ' ' . PMA_showMySQLDocu('', '', TRUE) . "\n"; } echo '</div>' . "\n"; /** * Displays the MySQL servers choice form */ if ($GLOBALS['cfg']['LeftDisplayServers'] && (count($GLOBALS['cfg']['Servers']) > 1 || $server == 0 && count($GLOBALS['cfg']['Servers']) == 1)) { echo '<div id="serverinfo">'; include './libraries/select_server.lib.php'; PMA_select_server(true, true); echo '</div><br />'; } // end if LeftDisplayServers
/** * User is not allowed to login to MySQL -> authentication failed * * @global string the MySQL error message PHP returns * @global string the connection type (persistent or not) * @global string the MySQL server port to use * @global string the MySQL socket port to use * @global array the current server settings * @global string the font face to use in case of failure * @global string the default font size to use in case of failure * @global string the big font size to use in case of failure * @global boolean tell the "PMA_mysqlDie()" function headers have been * sent * * @return boolean always true (no return indeed) * * @access public */ function PMA_auth_fails() { global $php_errormsg, $cfg; $conn_error = PMA_DBI_getError(); if (!$conn_error) { if (isset($php_errormsg)) { $conn_error = $php_errormsg; } else { $conn_error = $GLOBALS['strConnectionError']; } } // Defines the charset to be used header('Content-Type: text/html; charset=' . $GLOBALS['charset']); /* HTML header */ $page_title = $GLOBALS['strAccessDenied']; require './libraries/header_meta_style.inc.php'; ?> </head> <body> <br /><br /> <center> <h1><?php echo sprintf($GLOBALS['strWelcome'], ' phpMyAdmin ' . PMA_VERSION); ?> </h1> </center> <br /> <table border="0" cellpadding="0" cellspacing="3" align="center" width="80%"> <tr> <td> <?php echo "\n"; $GLOBALS['is_header_sent'] = TRUE; //TODO: I have included this div from libraries/header.inc.php to work around // an undefined variable in tooltip.js, when the server // is not responding. Work has to be done to merge all code that // starts the page (DOCTYPE and this div) to one place ?> <div id="TooltipContainer" onmouseover="holdTooltip();" onmouseout="swapTooltip('default');"></div> <?php if (isset($GLOBALS['allowDeny_forbidden']) && $GLOBALS['allowDeny_forbidden']) { echo '<p>' . $GLOBALS['strAccessDenied'] . '</p>' . "\n"; } else { // Check whether user has configured something if ($_SESSION['PMA_Config']->source_mtime == 0) { echo '<p>' . sprintf($GLOBALS['strAccessDeniedCreateConfig'], '<a href="scripts/setup.php">', '</a>') . '</p>' . "\n"; } elseif (!isset($GLOBALS['errno']) || isset($GLOBALS['errno']) && $GLOBALS['errno'] != 2002 && $GLOBALS['errno'] != 2003) { // if we display the "Server not responding" error, do not confuse users // by telling them they have a settings problem // (note: it's true that they could have a badly typed host name, but // anyway the current $strAccessDeniedExplanation tells that the server // rejected the connection, which is not really what happened) // 2002 is the error given by mysqli // 2003 is the error given by mysql echo '<p>' . $GLOBALS['strAccessDeniedExplanation'] . '</p>' . "\n"; } PMA_mysqlDie($conn_error, '', true, '', false); } if (!empty($GLOBALS['PMA_errors']) && is_array($GLOBALS['PMA_errors'])) { foreach ($GLOBALS['PMA_errors'] as $error) { echo '<div class="error">' . $error . '</div>' . "\n"; } } ?> </td> </tr> <?php if (count($GLOBALS['cfg']['Servers']) > 1) { // offer a chance to login to other servers if the current one failed require_once './libraries/select_server.lib.php'; echo '<tr>' . "\n"; echo ' <td>' . "\n"; PMA_select_server(TRUE, TRUE); echo ' </td>' . "\n"; echo '</tr>' . "\n"; } echo '</table>' . "\n"; require_once './libraries/footer.inc.php'; return TRUE; }
/** * User is not allowed to login to MySQL -> authentication failed * * @global string the MySQL error message PHP returns * @global string the connection type (persistent or not) * @global string the MySQL server port to use * @global string the MySQL socket port to use * @global array the current server settings * @global string the font face to use in case of failure * @global string the default font size to use in case of failure * @global string the big font size to use in case of failure * @global boolean tell the "PMA_mysqlDie()" function headers have been * sent * * @return boolean always true (no return indeed) * * @access public */ function PMA_auth_fails() { global $php_errormsg, $cfg; $conn_error = PMA_DBI_getError(); if (!$conn_error) { if (isset($php_errormsg)) { $conn_error = $php_errormsg; } else { $conn_error = __('Cannot connect: invalid settings.'); } } // Defines the charset to be used header('Content-Type: text/html; charset=' . $GLOBALS['charset']); /* HTML header */ $page_title = __('Access denied'); require './libraries/header_meta_style.inc.php'; ?> </head> <body> <br /><br /> <center> <h1><?php echo sprintf(__('Welcome to %s'), ' phpMyAdmin '); ?> </h1> </center> <br /> <table border="0" cellpadding="0" cellspacing="3" align="center" width="80%"> <tr> <td> <?php $GLOBALS['is_header_sent'] = TRUE; if (isset($GLOBALS['allowDeny_forbidden']) && $GLOBALS['allowDeny_forbidden']) { trigger_error(__('Access denied'), E_USER_NOTICE); } else { // Check whether user has configured something if ($GLOBALS['PMA_Config']->source_mtime == 0) { echo '<p>' . sprintf(__('You probably did not create a configuration file. You might want to use the %1$ssetup script%2$s to create one.'), '<a href="setup/">', '</a>') . '</p>' . "\n"; } elseif (!isset($GLOBALS['errno']) || isset($GLOBALS['errno']) && $GLOBALS['errno'] != 2002 && $GLOBALS['errno'] != 2003) { // if we display the "Server not responding" error, do not confuse users // by telling them they have a settings problem // (note: it's true that they could have a badly typed host name, but // anyway the current message tells that the server // rejected the connection, which is not really what happened) // 2002 is the error given by mysqli // 2003 is the error given by mysql trigger_error(__('phpMyAdmin tried to connect to the MySQL server, and the server rejected the connection. You should check the host, username and password in your configuration and make sure that they correspond to the information given by the administrator of the MySQL server.'), E_USER_WARNING); } PMA_mysqlDie($conn_error, '', true, '', false); } $GLOBALS['error_handler']->dispUserErrors(); ?> </td> </tr> <?php if (count($GLOBALS['cfg']['Servers']) > 1) { // offer a chance to login to other servers if the current one failed require_once './libraries/select_server.lib.php'; echo '<tr>' . "\n"; echo ' <td>' . "\n"; PMA_select_server(TRUE, TRUE); echo ' </td>' . "\n"; echo '</tr>' . "\n"; } echo '</table>' . "\n"; require './libraries/footer.inc.php'; return TRUE; }
/** * Displays authentication form * * this function MUST exit/quit the application * * @global string the last connection error * * @access public */ function PMA_auth() { global $conn_error; /* Perform logout to custom URL */ if (!empty($_REQUEST['old_usr']) && !empty($GLOBALS['cfg']['Server']['LogoutURL'])) { PMA_sendHeaderLocation($GLOBALS['cfg']['Server']['LogoutURL']); exit; } /* No recall if blowfish secret is not configured as it would produce garbage */ if ($GLOBALS['cfg']['LoginCookieRecall'] && !empty($GLOBALS['cfg']['blowfish_secret'])) { $default_user = $GLOBALS['PHP_AUTH_USER']; $default_server = $GLOBALS['pma_auth_server']; $autocomplete = ''; } else { $default_user = ''; $default_server = ''; // skip the IE autocomplete feature. $autocomplete = ' autocomplete="off"'; } $cell_align = $GLOBALS['text_dir'] == 'ltr' ? 'left' : 'right'; // Defines the charset to be used header('Content-Type: text/html; charset=utf-8'); /* HTML header; do not show here the PMA version to improve security */ $page_title = 'phpMyAdmin '; include './libraries/header_meta_style.inc.php'; // if $page_title is set, this script uses it as the title: include './libraries/header_scripts.inc.php'; ?> </head> <body class="loginform"> <?php if (file_exists(CUSTOM_HEADER_FILE)) { include CUSTOM_HEADER_FILE; } ?> <div class="container"> <a href="<?php echo PMA_linkURL('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> <?php echo sprintf(__('Welcome to %s'), '<bdo dir="ltr" lang="en">' . $page_title . '</bdo>'); ?> </h1> <?php // Show error message if (!empty($conn_error)) { PMA_Message::rawError($conn_error)->display(); } echo "<noscript>\n"; PMA_message::error(__("Javascript must be enabled past this point"))->display(); echo "</noscript>\n"; echo "<div class='hide js-show'>"; // Displays the languages form if (empty($GLOBALS['cfg']['Lang'])) { include_once './libraries/display_select_lang.lib.php'; // use fieldset, don't show doc link PMA_select_language(true, false); } echo "</div>"; ?> <br /> <!-- Login form --> <form method="post" action="index.php" name="login_form"<?php echo $autocomplete; ?> target="_top" class="login hide js-show"> <fieldset> <legend> <?php echo __('Log in'); echo PMA_showDocu(''); ?> </legend> <?php if ($GLOBALS['cfg']['AllowArbitraryServer']) { ?> <div class="item"> <label for="input_servername" title="<?php echo __('You can enter hostname/IP address and port separated by space.'); ?> "><?php echo __('Server:'); ?> </label> <input type="text" name="pma_servername" id="input_servername" value="<?php echo htmlspecialchars($default_server); ?> " size="24" class="textfield" title="<?php echo __('You can enter hostname/IP address and port separated by space.'); ?> " /> </div> <?php } ?> <div class="item"> <label for="input_username"><?php echo __('Username:'******'Password:'******'cfg']['Servers']) > 1) { ?> <div class="item"> <label for="select_server"><?php echo __('Server Choice'); ?> :</label> <select name="server" id="select_server" <?php if ($GLOBALS['cfg']['AllowArbitraryServer']) { echo ' onchange="document.forms[\'login_form\'].elements[\'pma_servername\'].value = \'\'" '; } echo '>'; include_once './libraries/select_server.lib.php'; PMA_select_server(false, false); echo '</select></div>'; } else { echo ' <input type="hidden" name="server" value="' . $GLOBALS['server'] . '" />'; } // end if (server choice) ?> </fieldset> <fieldset class="tblFooters"> <input value="<?php echo __('Go'); ?> " type="submit" id="input_go" /> <?php $_form_params = array(); if (!empty($GLOBALS['target'])) { $_form_params['target'] = $GLOBALS['target']; } if (!empty($GLOBALS['db'])) { $_form_params['db'] = $GLOBALS['db']; } if (!empty($GLOBALS['table'])) { $_form_params['table'] = $GLOBALS['table']; } // do not generate a "server" hidden field as we want the "server" // drop-down to have priority echo PMA_generate_common_hidden_inputs($_form_params, '', 0, 'server'); ?> </fieldset> </form> <?php // BEGIN Swekey Integration Swekey_login('input_username', 'input_go'); // END Swekey Integration // show the "Cookies required" message only if cookies are disabled // (we previously tried to set some cookies) if (empty($_COOKIE)) { trigger_error(__('Cookies must be enabled past this point.'), E_USER_NOTICE); } if ($GLOBALS['error_handler']->hasDisplayErrors()) { echo '<div>'; $GLOBALS['error_handler']->dispErrors(); echo '</div>'; } ?> </div> <?php if (file_exists(CUSTOM_FOOTER_FILE)) { include CUSTOM_FOOTER_FILE; } ?> <script type="text/javascript"> //<![CDATA[ // show login form in top frame. if (top != self || document.body.className != 'loginform') { window.top.location.href=location; } //]]> </script> </body> </html> <?php exit; }
/** * User is not allowed to login to MySQL -> authentication failed * * @global string the MySQL error message PHP returns * @global string the connection type (persistent or not) * @global string the MySQL server port to use * @global string the MySQL socket port to use * @global array the current server settings * @global string the font face to use in case of failure * @global string the default font size to use in case of failure * @global string the big font size to use in case of failure * @global boolean tell the "PMA_mysqlDie()" function headers have been * sent * * @return boolean always true (no return indeed) * * @access public */ function PMA_auth_fails() { global $php_errormsg, $cfg; $conn_error = PMA_DBI_getError(); if (!$conn_error) { if (isset($php_errormsg)) { $conn_error = $php_errormsg; } else { $conn_error = $GLOBALS['strConnectionError']; } } // Defines the charset to be used header('Content-Type: text/html; charset=' . $GLOBALS['charset']); /* HTML header */ $page_title = $GLOBALS['strAccessDenied']; require './libraries/header_meta_style.inc.php'; ?> </head> <body> <br /><br /> <center> <h1><?php echo sprintf($GLOBALS['strWelcome'], ' phpMyAdmin '); ?></h1> </center> <br /> <table border="0" cellpadding="0" cellspacing="3" align="center" width="80%"> <tr> <td> <?php $GLOBALS['is_header_sent'] = TRUE; if (isset($GLOBALS['allowDeny_forbidden']) && $GLOBALS['allowDeny_forbidden']) { trigger_error($GLOBALS['strAccessDenied'], E_USER_NOTICE); } else { // Check whether user has configured something if ($_SESSION['PMA_Config']->source_mtime == 0) { echo '<p>' . sprintf($GLOBALS['strAccessDeniedCreateConfig'], '<a href="setup/">', '</a>') . '</p>' . "\n"; } elseif (!isset($GLOBALS['errno']) || (isset($GLOBALS['errno']) && $GLOBALS['errno'] != 2002) && $GLOBALS['errno'] != 2003) { // if we display the "Server not responding" error, do not confuse users // by telling them they have a settings problem // (note: it's true that they could have a badly typed host name, but // anyway the current $strAccessDeniedExplanation tells that the server // rejected the connection, which is not really what happened) // 2002 is the error given by mysqli // 2003 is the error given by mysql trigger_error($GLOBALS['strAccessDeniedExplanation'], E_USER_WARNING); } PMA_mysqlDie($conn_error, '', true, '', false); } $GLOBALS['error_handler']->dispUserErrors(); ?> </td> </tr> <?php if (count($GLOBALS['cfg']['Servers']) > 1) { // offer a chance to login to other servers if the current one failed require_once './libraries/select_server.lib.php'; echo '<tr>' . "\n"; echo ' <td>' . "\n"; PMA_select_server(TRUE, TRUE); echo ' </td>' . "\n"; echo '</tr>' . "\n"; } echo '</table>' . "\n"; require_once './libraries/footer.inc.php'; return TRUE; } // end of the 'PMA_auth_fails()' 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 $cfg, $lang, $server, $convcharset, $conn_error; /* Perform logout to custom URL */ if (!empty($_REQUEST['old_usr']) && !empty($GLOBALS['cfg']['Server']['LogoutURL'])) { PMA_sendHeaderLocation($GLOBALS['cfg']['Server']['LogoutURL']); exit; } // 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 './libs/header_meta_style.inc.php'; ?> <script type="text/javascript" language="javascript"> //<![CDATA[ // show login form in top frame if (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> <?php echo 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 './libs/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 './libs/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; }
/** * Displays authentication form * * this function MUST exit/quit the application * * @uses $GLOBALS['server'] * @uses $GLOBALS['PHP_AUTH_USER'] * @uses $GLOBALS['pma_auth_server'] * @uses $GLOBALS['text_dir'] * @uses $GLOBALS['pmaThemeImage'] * @uses $GLOBALS['charset'] * @uses $GLOBALS['target'] * @uses $GLOBALS['db'] * @uses $GLOBALS['table'] * @uses $GLOBALS['strWelcome'] * @uses $GLOBALS['strSecretRequired'] * @uses $GLOBALS['strError'] * @uses $GLOBALS['strLogin'] * @uses $GLOBALS['strLogServer'] * @uses $GLOBALS['strLogUsername'] * @uses $GLOBALS['strLogPassword'] * @uses $GLOBALS['strServerChoice'] * @uses $GLOBALS['strGo'] * @uses $GLOBALS['strCookiesRequired'] * @uses $GLOBALS['strPmaDocumentation'] * @uses $GLOBALS['pmaThemeImage'] * @uses $cfg['Servers'] * @uses $cfg['LoginCookieRecall'] * @uses $cfg['Lang'] * @uses $cfg['Server'] * @uses $cfg['ReplaceHelpImg'] * @uses $cfg['blowfish_secret'] * @uses $cfg['AllowArbitraryServer'] * @uses $_COOKIE * @uses $_REQUEST['old_usr'] * @uses PMA_sendHeaderLocation() * @uses PMA_select_language() * @uses PMA_select_server() * @uses file_exists() * @uses sprintf() * @uses count() * @uses htmlspecialchars() * @uses is_array() * @global string the last connection error * * @access public */ function PMA_auth() { global $conn_error; /* Perform logout to custom URL */ if (!empty($_REQUEST['old_usr']) && !empty($GLOBALS['cfg']['Server']['LogoutURL'])) { PMA_sendHeaderLocation($GLOBALS['cfg']['Server']['LogoutURL']); exit; } /* No recall if blowfish secret is not configured as it would produce garbage */ if ($GLOBALS['cfg']['LoginCookieRecall'] && !empty($GLOBALS['cfg']['blowfish_secret'])) { $default_user = $GLOBALS['PHP_AUTH_USER']; $default_server = $GLOBALS['pma_auth_server']; $autocomplete = ''; } else { $default_user = ''; $default_server = ''; // skip the IE autocomplete feature. $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_' . $GLOBALS['text_dir'] . '.png'; /* HTML header; do not show here the PMA version to improve security */ $page_title = 'phpMyAdmin '; require './libraries/header_meta_style.inc.php'; ?> <script type="text/javascript"> //<![CDATA[ // show login form in top frame if (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> <?php echo sprintf($GLOBALS['strWelcome'], '<bdo dir="ltr" xml:lang="en">' . $page_title . '</bdo>'); ?> </h1> <?php // Show error message if (!empty($conn_error)) { PMA_Message::rawError($conn_error)->display(); } // Displays the languages form if (empty($GLOBALS['cfg']['Lang'])) { require_once './libraries/display_select_lang.lib.php'; // use fieldset, don't show doc link PMA_select_language(true, false); } ?> <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']; echo '<a href="./Documentation.html" target="documentation" ' . 'title="' . $GLOBALS['strPmaDocumentation'] . '">'; if ($GLOBALS['cfg']['ReplaceHelpImg']) { echo '<img class="icon" src="' . $GLOBALS['pmaThemeImage'] . 'b_help.png" width="11" height="11" alt="' . $GLOBALS['strPmaDocumentation'] . '" />'; } else { echo '(*)'; } echo '</a>'; ?> </legend> <?php if ($GLOBALS['cfg']['AllowArbitraryServer']) { ?> <div class="item"> <label for="input_servername" title="<?php echo $GLOBALS['strLogServerHelp']; ?> "><?php echo $GLOBALS['strLogServer']; ?> </label> <input type="text" name="pma_servername" id="input_servername" value="<?php echo htmlspecialchars($default_server); ?> " size="24" class="textfield" title="<?php echo $GLOBALS['strLogServerHelp']; ?> " /> </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 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($GLOBALS['cfg']['Servers']) > 1) { ?> <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); echo '</select></div>'; } else { echo ' <input type="hidden" name="server" value="' . $GLOBALS['server'] . '" />'; } // end if (server choice) ?> </fieldset> <fieldset class="tblFooters"> <input value="<?php echo $GLOBALS['strGo']; ?> " type="submit" id="input_go" /> <?php $_form_params = array(); if (!empty($GLOBALS['target'])) { $_form_params['target'] = $GLOBALS['target']; } if (!empty($GLOBALS['db'])) { $_form_params['db'] = $GLOBALS['db']; } if (!empty($GLOBALS['table'])) { $_form_params['table'] = $GLOBALS['table']; } // do not generate a "server" hidden field as we want the "server" // drop-down to have priority echo PMA_generate_common_hidden_inputs($_form_params, '', 0, 'server'); ?> </fieldset> </form> <?php // BEGIN Swekey Integration Swekey_login('input_username', 'input_go'); // END Swekey Integration // show the "Cookies required" message only if cookies are disabled // (we previously tried to set some cookies) if (empty($_COOKIE)) { trigger_error($GLOBALS['strCookiesRequired'], E_USER_NOTICE); } if ($GLOBALS['error_handler']->hasDisplayErrors()) { echo '<div>'; $GLOBALS['error_handler']->dispErrors(); echo '</div>'; } ?> </div> <script type="text/javascript"> // <![CDATA[ function PMA_focusInput() { var input_username = document.getElementById('input_username'); var input_password = document.getElementById('input_password'); if (input_username.value == '') { input_username.focus(); } else { input_password.focus(); } } window.setTimeout('PMA_focusInput()', 500); // ]]> </script> <?php if (file_exists('./config.footer.inc.php')) { require './config.footer.inc.php'; } ?> </body> </html> <?php exit; }
/** * Displays authentication form * * this function MUST exit/quit the application * * @uses $GLOBALS['server'] * @uses $GLOBALS['PHP_AUTH_USER'] * @uses $GLOBALS['pma_auth_server'] * @uses $GLOBALS['text_dir'] * @uses $GLOBALS['pmaThemeImage'] * @uses $GLOBALS['charset'] * @uses $GLOBALS['target'] * @uses $GLOBALS['db'] * @uses $GLOBALS['table'] * @uses $GLOBALS['PMA_errors'] * @uses $GLOBALS['convcharset'] * @uses $GLOBALS['lang'] * @uses $GLOBALS['strWelcome'] * @uses $GLOBALS['strSecretRequired'] * @uses $GLOBALS['strError'] * @uses $GLOBALS['strLogin'] * @uses $GLOBALS['strLogServer'] * @uses $GLOBALS['strLogUsername'] * @uses $GLOBALS['strLogPassword'] * @uses $GLOBALS['strServerChoice'] * @uses $GLOBALS['strGo'] * @uses $GLOBALS['strCookiesRequired'] * @uses $GLOBALS['strPmaDocumentation'] * @uses $GLOBALS['pmaThemeImage'] * @uses $cfg['Servers'] * @uses $cfg['LoginCookieRecall'] * @uses $cfg['Lang'] * @uses $cfg['Server'] * @uses $cfg['ReplaceHelpImg'] * @uses $cfg['blowfish_secret'] * @uses $cfg['AllowArbitraryServer'] * @uses $_COOKIE * @uses $_REQUEST['old_usr'] * @uses PMA_sendHeaderLocation() * @uses PMA_select_language() * @uses PMA_select_server() * @uses PMA_VERSION * @uses file_exists() * @uses sprintf() * @uses count() * @uses htmlspecialchars() * @uses is_array() * @global string the last connection error * * @access public */ function PMA_auth() { global $conn_error; /* Perform logout to custom URL */ if (!empty($_REQUEST['old_usr']) && !empty($GLOBALS['cfg']['Server']['LogoutURL'])) { PMA_sendHeaderLocation($GLOBALS['cfg']['Server']['LogoutURL']); exit; } if ($GLOBALS['cfg']['LoginCookieRecall']) { $default_user = $GLOBALS['PHP_AUTH_USER']; $default_server = $GLOBALS['pma_auth_server']; $autocomplete = ''; } else { $default_user = ''; $default_server = ''; // skip the IE autocomplete feature. $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_' . $GLOBALS['text_dir'] . '.png'; /* HTML header */ $page_title = 'phpMyAdmin ' . PMA_VERSION; require './libraries/header_meta_style.inc.php'; ?> <script type="text/javascript"> //<![CDATA[ // show login form in top frame if (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> <?php echo sprintf($GLOBALS['strWelcome'], '<bdo dir="ltr" xml:lang="en">' . $page_title . '</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($GLOBALS['cfg']['Lang'])) { require_once './libraries/display_select_lang.lib.php'; PMA_select_language(true); } // 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></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']; echo '<a href="./Documentation.html" target="documentation" ' . 'title="' . $GLOBALS['strPmaDocumentation'] . '">'; if ($GLOBALS['cfg']['ReplaceHelpImg']) { echo '<img class="icon" src="' . $GLOBALS['pmaThemeImage'] . 'b_help.png" width="11" height="11" alt="' . $GLOBALS['strPmaDocumentation'] . '" />'; } else { echo '(*)'; } echo '</a>'; ?> </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 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 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($GLOBALS['cfg']['Servers']) > 1) { ?> <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 = \'\'" '; } echo '>'; require_once './libraries/select_server.lib.php'; PMA_select_server(false, false); echo '</select></div>'; } else { echo ' <input type="hidden" name="server" value="' . $GLOBALS['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 $GLOBALS['lang']; ?> " /> <input type="hidden" name="convcharset" value="<?php echo htmlspecialchars($GLOBALS['convcharset'], ENT_QUOTES); ?> " /> <?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"; } } // the warning is also displayed on main page but show it also here, // because on some PHP versions running on 64-bit, the blowfish library // does not work and this would prevent login if (defined('PMA_WARN_FOR_MCRYPT')) { echo '<div class="warning">' . PMA_sanitize(sprintf($GLOBALS['strCantLoad'], 'mcrypt')) . '</div>' . "\n"; } ?> </div> <script type="text/javascript"> // <![CDATA[ function PMA_focusInput() { var input_username = document.getElementById('input_username'); var input_password = document.getElementById('input_password'); if (input_username.value == '') { input_username.focus(); } else { input_password.focus(); } } window.setTimeout('PMA_focusInput()', 500); // ]]> </script> </body> </html> <?php if (file_exists('./config.footer.inc.php')) { require './config.footer.inc.php'; } exit; }
// Logout for advanced authentication if ($GLOBALS['cfg']['Server']['auth_type'] != 'config') { echo $GLOBALS['cfg']['MainPageIconic'] ? '' : ' - '; echo '<a href="index.php?' . $query_url . '&old_usr='******'" target="_parent"' . ' title="' . $strLogout . '" >' . ($GLOBALS['cfg']['MainPageIconic'] ? '<img class="icon" src="' . $pmaThemeImage . 's_loggoff.png" ' . ' width="16" height="16" alt="' . $strLogout . '" />' : $strLogout) . '</a>' . "\n"; } // end if ($GLOBALS['cfg']['Server']['auth_type'] != 'config' $anchor = 'querywindow.php?' . PMA_generate_common_url($db, $table); if ($GLOBALS['cfg']['MainPageIconic']) { $query_frame_link_text = '<img class="icon" src="' . $pmaThemeImage . 'b_selboard.png"' . ' width="16" height="16" alt="' . $strQueryFrame . '" />'; } else { echo '<br />' . "\n"; $query_frame_link_text = $strQueryFrame; } echo '<a href="' . $anchor . '&no_js=true"' . ' title="' . $strQueryFrame . '"'; echo ' onclick="javascript:window.parent.open_querywindow();' . ' return false;"'; echo '>' . $query_frame_link_text . '</a>' . "\n"; } // end if ($server != 0) if ($GLOBALS['cfg']['MainPageIconic']) { echo ' <a href="Documentation.html" target="documentation"' . ' title="' . $strPmaDocumentation . '" >' . '<img class="icon" src="' . $pmaThemeImage . 'b_docs.png" width="16" height="16"' . ' alt="' . $strPmaDocumentation . '" /></a>' . "\n"; echo ' ' . PMA_showMySQLDocu('', '', TRUE) . "\n"; } echo '</div>' . "\n"; /** * Displays the MySQL servers choice form */ if ($GLOBALS['cfg']['LeftDisplayServers'] && (count($GLOBALS['cfg']['Servers']) > 1 || $server == 0 && count($GLOBALS['cfg']['Servers']) == 1)) { include './libraries/select_server.lib.php'; PMA_select_server(TRUE, TRUE); } // end if LeftDisplayServers