/**
  * Displays authentication form
  *
  * this function MUST exit/quit the application
  *
  * @global string $conn_error the last connection error
  *
  * @return boolean|void
  */
 public function auth()
 {
     global $conn_error;
     $response = PMA_Response::getInstance();
     if ($response->isAjax()) {
         $response->setRequestStatus(false);
         // redirect_flag redirects to the login page
         $response->addJSON('redirect_flag', '1');
         if (defined('TESTSUITE')) {
             return true;
         } else {
             exit;
         }
     }
     /* Perform logout to custom URL */
     if (!empty($_REQUEST['old_usr']) && !empty($GLOBALS['cfg']['Server']['LogoutURL'])) {
         PMA_sendHeaderLocation($GLOBALS['cfg']['Server']['LogoutURL']);
         if (defined('TESTSUITE')) {
             return true;
         } else {
             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"';
     }
     $response->getFooter()->setMinimal();
     $header = $response->getHeader();
     $header->setBodyId('loginform');
     $header->setTitle('phpMyAdmin');
     $header->disableMenuAndConsole();
     $header->disableWarnings();
     if (file_exists(CUSTOM_HEADER_FILE)) {
         include CUSTOM_HEADER_FILE;
     }
     echo '
 <div class="container">
 <a href="';
     echo PMA_linkURL('https://www.phpmyadmin.net/');
     echo '" target="_blank" class="logo">';
     $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" />';
     }
     echo '</a>
    <h1>';
     echo sprintf(__('Welcome to %s'), '<bdo dir="ltr" lang="en">phpMyAdmin</bdo>');
     echo "</h1>";
     // Show error message
     if (!empty($conn_error)) {
         PMA_Message::rawError($conn_error)->display();
     } elseif (isset($_GET['session_expired']) && intval($_GET['session_expired']) == 1) {
         PMA_Message::rawError(__('Your session has expired. Please log in again.'))->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
         echo PMA_getLanguageSelectorHtml(true, false);
     }
     echo '</div>
 <br />
 <!-- Login form -->
 <form method="post" action="index.php" name="login_form"' . $autocomplete . ' class="disableAjax login hide js-show">
     <fieldset>
     <legend>';
     echo __('Log in');
     echo PMA_Util::showDocu('index');
     echo '</legend>';
     if ($GLOBALS['cfg']['AllowArbitraryServer']) {
         echo '
         <div class="item">
             <label for="input_servername" title="';
         echo __('You can enter hostname/IP address and port separated by space.');
         echo '">';
         echo __('Server:');
         echo '</label>
             <input type="text" name="pma_servername" id="input_servername"';
         echo ' value="';
         echo htmlspecialchars($default_server);
         echo '" size="24" class="textfield" title="';
         echo __('You can enter hostname/IP address and port separated by space.');
         echo '" />
         </div>';
     }
     echo '<div class="item">
             <label for="input_username">' . __('Username:'******'</label>
             <input type="text" name="pma_username" id="input_username" ' . 'value="' . htmlspecialchars($default_user) . '" size="24"' . ' class="textfield"/>
         </div>
         <div class="item">
             <label for="input_password">' . __('Password:'******'</label>
             <input type="password" name="pma_password" id="input_password"' . ' value="" size="24" class="textfield" />
         </div>';
     if (count($GLOBALS['cfg']['Servers']) > 1) {
         echo '<div class="item">
             <label for="select_server">' . __('Server Choice:') . '</label>
             <select name="server" id="select_server"';
         if ($GLOBALS['cfg']['AllowArbitraryServer']) {
             echo ' onchange="document.forms[\'login_form\'].' . 'elements[\'pma_servername\'].value = \'\'" ';
         }
         echo '>';
         include_once './libraries/select_server.lib.php';
         echo PMA_selectServer(false, false);
         echo '</select></div>';
     } else {
         echo '    <input type="hidden" name="server" value="' . $GLOBALS['server'] . '" />';
     }
     // end if (server choice)
     // Add captcha input field if reCaptcha is enabled
     if (!empty($GLOBALS['cfg']['CaptchaLoginPrivateKey']) && !empty($GLOBALS['cfg']['CaptchaLoginPublicKey'])) {
         // If enabled show captcha to the user on the login screen.
         echo '<script src="https://www.google.com/recaptcha/api.js?hl=' . $GLOBALS['lang'] . '" async defer></script>';
         echo '<div class="g-recaptcha" data-sitekey="' . $GLOBALS['cfg']['CaptchaLoginPublicKey'] . '"></div>';
     }
     echo '</fieldset>
     <fieldset class="tblFooters">
         <input value="' . __('Go') . '" type="submit" id="input_go" />';
     $_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_URL_getHiddenInputs($_form_params, '', 0, 'server');
     echo '</fieldset>
 </form>';
     // BEGIN Swekey Integration
     Swekey_login('input_username', 'input_go');
     // END Swekey Integration
     if ($GLOBALS['error_handler']->hasDisplayErrors()) {
         echo '<div id="pma_errors">';
         $GLOBALS['error_handler']->dispErrors();
         echo '</div>';
     }
     echo '</div>';
     if (file_exists(CUSTOM_FOOTER_FILE)) {
         include CUSTOM_FOOTER_FILE;
     }
     if (!defined('TESTSUITE')) {
         exit;
     } else {
         return true;
     }
 }
示例#2
0
        // end if
        echo '    <li id="li_select_mysql_collation" class="no_bullets" >';
        echo '        <form method="post" action="index.php">', "\n" . PMA_URL_getHiddenInputs(null, null, 4, 'collation_connection') . '            <label for="select_collation_connection">' . "\n" . '                ' . PMA\libraries\Util::getImage('s_asci.png') . "&nbsp;" . __('Server connection collation') . "\n" . PMA\libraries\Util::showMySQLDocu('Charset-connection') . ': ' . "\n" . '            </label>' . "\n" . PMA_generateCharsetDropdownBox(PMA_CSDROPDOWN_COLLATION, 'collation_connection', 'select_collation_connection', $collation_connection, true, true) . '        </form>' . "\n" . '    </li>' . "\n";
    }
    // end of if ($server > 0)
    echo '</ul>';
    echo '</div>';
}
echo '<div class="group">';
echo '<h2>', __('Appearance settings'), '</h2>';
echo '  <ul>';
// Displays language selection combo
if (empty($cfg['Lang']) && count($GLOBALS['available_languages']) > 1) {
    echo '<li id="li_select_lang" class="no_bullets">';
    include_once 'libraries/display_select_lang.lib.php';
    echo PMA\libraries\Util::getImage('s_lang.png'), " ", PMA_getLanguageSelectorHtml();
    echo '</li>';
}
// ThemeManager if available
if ($GLOBALS['cfg']['ThemeManager']) {
    echo '<li id="li_select_theme" class="no_bullets">';
    echo PMA\libraries\Util::getImage('s_theme.png'), " ", $_SESSION['PMA_Theme_Manager']->getHtmlSelectBox();
    echo '</li>';
}
echo '<li id="li_select_fontsize">';
echo PMA\libraries\Config::getFontsizeForm();
echo '</li>';
echo '</ul>';
// User preferences
if ($server > 0) {
    echo '<ul>';
示例#3
0
        // end if
        echo '    <li id="li_select_mysql_collation" class="no_bullets" >';
        echo '        <form method="post" action="index.php">' . "\n" . PMA_URL_getHiddenInputs(null, null, 4, 'collation_connection') . '            <label for="select_collation_connection">' . "\n" . '                ' . PMA_Util::getImage('s_asci.png') . " " . __('Server connection collation') . "\n" . PMA_Util::showMySQLDocu('Charset-connection') . ': ' . "\n" . '            </label>' . "\n" . PMA_generateCharsetDropdownBox(PMA_CSDROPDOWN_COLLATION, 'collation_connection', 'select_collation_connection', $collation_connection, true, true) . '        </form>' . "\n" . '    </li>' . "\n";
    }
    // end of if ($server > 0 && !PMA_DRIZZLE)
    echo '</ul>';
    echo '</div>';
}
echo '<div class="group">';
echo '<h2>' . __('Appearance Settings') . '</h2>';
echo '  <ul>';
// Displays language selection combo
if (empty($cfg['Lang']) && count($GLOBALS['available_languages']) > 1) {
    echo '<li id="li_select_lang" class="no_bullets">';
    include_once 'libraries/display_select_lang.lib.php';
    echo PMA_Util::getImage('s_lang.png') . " " . PMA_getLanguageSelectorHtml();
    echo '</li>';
}
// ThemeManager if available
if ($GLOBALS['cfg']['ThemeManager']) {
    echo '<li id="li_select_theme" class="no_bullets">';
    echo PMA_Util::getImage('s_theme.png') . " " . $_SESSION['PMA_Theme_Manager']->getHtmlSelectBox();
    echo '</li>';
}
echo '<li id="li_select_fontsize">';
echo PMA_Config::getFontsizeForm();
echo '</li>';
echo '</ul>';
// User preferences
if ($server > 0) {
    echo '<ul>';