home *** CD-ROM | disk | FTP | other *** search
/ Enter 2004 June / ENTER.ISO / files / xampp-win32-1.4.5-installer.exe / xampp / config.auth.lib.php < prev    next >
Encoding:
PHP Script  |  2003-11-26  |  3.9 KB  |  125 lines

  1. <?php
  2. /* $Id: config.auth.lib.php,v 2.2 2003/11/26 22:52:24 rabus Exp $ */
  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;
  71.     global $connect_func, $server_port, $server_socket, $cfg;
  72.     global $right_font_family, $font_size, $font_bigger;
  73.     global $is_header_sent;
  74.     if (PMA_mysql_error()) {
  75.         $conn_error = PMA_mysql_error();
  76.     } else if (isset($php_errormsg)) {
  77.         $conn_error = $php_errormsg;
  78.     } else {
  79.         $conn_error = 'Cannot connect: invalid settings.';
  80.     }
  81. /* Commented out by Nijel: This causes displaying login and password from
  82.  * config when connection to MySQL server can't be established. (SQL parser
  83.  * fails on this and then displays it as wrong SQL.
  84.  */
  85. /*      $local_query    = $connect_func . '('
  86.                     . $cfg['Server']['host'] . $server_port . $server_socket . ', '
  87.                     . $cfg['Server']['user'] . ', '
  88.                     . $cfg['Server']['password'] . ')';*/
  89.     $local_query     = '';
  90.  
  91.     // Defines the charset to be used
  92.     header('Content-Type: text/html; charset=' . $GLOBALS['charset']);
  93.     ?>
  94. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  95.     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  96. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $GLOBALS['available_languages'][$GLOBALS['lang']][2]; ?>" lang="<?php echo $GLOBALS['available_languages'][$GLOBALS['lang']][2]; ?>" dir="<?php echo $GLOBALS['text_dir']; ?>">
  97.  
  98. <head>
  99. <title><?php echo $GLOBALS['strAccessDenied']; ?></title>
  100. <meta http-equiv="Content-Type" content="text/html; charset=<?php echo $GLOBALS['charset']; ?>" />
  101. <style type="text/css">
  102. <!--
  103. body     {font-family: <?php echo $right_font_family; ?>; font-size: <?php echo $font_size; ?>; color: #000000}
  104. h1       {font-family: <?php echo $right_font_family; ?>; font-size: <?php echo $font_bigger; ?>; font-weight: bold}
  105. //-->
  106. </style>
  107. </head>
  108.  
  109. <body bgcolor="<?php echo $cfg['RightBgColor']; ?>">
  110. <br /><br />
  111. <center>
  112.     <h1><?php echo sprintf($GLOBALS['strWelcome'], ' phpMyAdmin ' . PMA_VERSION); ?></h1>
  113. </center>
  114. <br />
  115.     <?php
  116.     echo "\n";
  117.     $is_header_sent = TRUE;
  118.     echo '<p>' . $GLOBALS['strAccessDeniedExplanation'] . '</p>' . "\n";
  119.     PMA_mysqlDie($conn_error, $local_query, FALSE);
  120.  
  121.     return TRUE;
  122. } // end of the 'PMA_auth_fails()' function
  123.  
  124. ?>
  125.