[ Index ]
 

Code source de phpMyAdmin 2.10.3

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/libraries/auth/ -> config.auth.lib.php (source)

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


Généré le : Mon Nov 26 15:18:20 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics