home *** CD-ROM | disk | FTP | other *** search
/ Cricao de Sites - 650 Layouts Prontos / WebMasters.iso / Servidores / xampp-win32-1.6.7-installer.exe / phpMyAdmin / libraries / auth / config.auth.lib.php next >
Encoding:
PHP Script  |  2008-06-23  |  4.6 KB  |  153 lines

  1. <?php
  2. /* vim: set expandtab sw=4 ts=4 sts=4: */
  3. /**
  4.  * Set of functions used to run config authentication (ie no authentication).
  5.  *
  6.  * @version $Id: config.auth.lib.php 10240 2007-04-01 11:02:46Z cybot_tm $
  7.  */
  8.  
  9.  
  10. /**
  11.  * Displays authentication form
  12.  *
  13.  * @return  boolean   always true
  14.  *
  15.  * @access  public
  16.  */
  17. function PMA_auth()
  18. {
  19.     return TRUE;
  20. } // end of the 'PMA_auth()' function
  21.  
  22.  
  23. /**
  24.  * Gets advanced authentication settings
  25.  *
  26.  * @return  boolean   always true
  27.  *
  28.  * @access  public
  29.  */
  30. function PMA_auth_check()
  31. {
  32.     return TRUE;
  33. } // end of the 'PMA_auth_check()' function
  34.  
  35.  
  36. /**
  37.  * Set the user and password after last checkings if required
  38.  *
  39.  * @return  boolean   always true
  40.  *
  41.  * @access  public
  42.  */
  43. function PMA_auth_set_user()
  44. {
  45.     return TRUE;
  46. } // end of the 'PMA_auth_set_user()' function
  47.  
  48.  
  49. /**
  50.  * User is not allowed to login to MySQL -> authentication failed
  51.  *
  52.  * @global  string    the MySQL error message PHP returns
  53.  * @global  string    the connection type (persistent or not)
  54.  * @global  string    the MySQL server port to use
  55.  * @global  string    the MySQL socket port to use
  56.  * @global  array     the current server settings
  57.  * @global  string    the font face to use in case of failure
  58.  * @global  string    the default font size to use in case of failure
  59.  * @global  string    the big font size to use in case of failure
  60.  * @global  boolean   tell the "PMA_mysqlDie()" function headers have been
  61.  *                    sent
  62.  *
  63.  * @return  boolean   always true (no return indeed)
  64.  *
  65.  * @access  public
  66.  */
  67. function PMA_auth_fails()
  68. {
  69.     global $php_errormsg, $cfg;
  70.  
  71.     $conn_error = PMA_DBI_getError();
  72.     if (!$conn_error) {
  73.         if (isset($php_errormsg)) {
  74.             $conn_error = $php_errormsg;
  75.         } else {
  76.             $conn_error = $GLOBALS['strConnectionError'];
  77.         }
  78.     }
  79.  
  80.     // Defines the charset to be used
  81.     header('Content-Type: text/html; charset=' . $GLOBALS['charset']);
  82.     /* HTML header */
  83.     $page_title = $GLOBALS['strAccessDenied'];
  84.     require './libraries/header_meta_style.inc.php';
  85.     ?>
  86. </head>
  87.  
  88. <body>
  89. <br /><br />
  90. <center>
  91.     <h1><?php echo sprintf($GLOBALS['strWelcome'], ' phpMyAdmin ' . PMA_VERSION); ?></h1>
  92. </center>
  93. <br />
  94. <table border="0" cellpadding="0" cellspacing="3" align="center" width="80%">
  95.     <tr>
  96.         <td>
  97.     <?php
  98.     echo "\n";
  99.     $GLOBALS['is_header_sent'] = TRUE;
  100.  
  101.     /**
  102.      * @todo I have included this div from libraries/header.inc.php to work around
  103.      * an undefined variable in tooltip.js, when the server is not responding.
  104.      * Work has to be done to merge all code that starts the page (DOCTYPE and
  105.      * this div) to one place
  106.      */
  107.     ?>
  108.     <div id="TooltipContainer" onmouseover="holdTooltip();" onmouseout="swapTooltip('default');"></div>
  109.     <?php
  110.  
  111.     if (isset($GLOBALS['allowDeny_forbidden']) && $GLOBALS['allowDeny_forbidden']) {
  112.         echo '<p>' . $GLOBALS['strAccessDenied'] . '</p>' . "\n";
  113.     } else {
  114.         // Check whether user has configured something
  115.         if ($_SESSION['PMA_Config']->source_mtime == 0) {
  116.             echo '<p>' . sprintf($GLOBALS['strAccessDeniedCreateConfig'], '<a href="scripts/setup.php">', '</a>') . '</p>' . "\n";
  117.         } elseif (!isset($GLOBALS['errno']) || (isset($GLOBALS['errno']) && $GLOBALS['errno'] != 2002) && $GLOBALS['errno'] != 2003) {
  118.         // if we display the "Server not responding" error, do not confuse users
  119.         // by telling them they have a settings problem
  120.         // (note: it's true that they could have a badly typed host name, but
  121.         //  anyway the current $strAccessDeniedExplanation tells that the server
  122.         //  rejected the connection, which is not really what happened)
  123.         // 2002 is the error given by mysqli
  124.         // 2003 is the error given by mysql
  125.             echo '<p>' . $GLOBALS['strAccessDeniedExplanation'] . '</p>' . "\n";
  126.         }
  127.         PMA_mysqlDie($conn_error, '', true, '', false);
  128.     }
  129.     if (! empty($GLOBALS['PMA_errors']) && is_array($GLOBALS['PMA_errors'])) {
  130.         foreach ($GLOBALS['PMA_errors'] as $error) {
  131.             echo '<div class="error">' . $error . '</div>' . "\n";
  132.         }
  133.     }
  134. ?>
  135.         </td>
  136.     </tr>
  137. <?php
  138.     if (count($GLOBALS['cfg']['Servers']) > 1) {
  139.         // offer a chance to login to other servers if the current one failed
  140.         require_once './libraries/select_server.lib.php';
  141.         echo '<tr>' . "\n";
  142.         echo ' <td>' . "\n";
  143.         PMA_select_server(TRUE, TRUE);
  144.         echo ' </td>' . "\n";
  145.         echo '</tr>' . "\n";
  146.     }
  147.     echo '</table>' . "\n";
  148.     require_once './libraries/footer.inc.php';
  149.     return TRUE;
  150. } // end of the 'PMA_auth_fails()' function
  151.  
  152. ?>
  153.