Advisor: properly handle concurrent_insert on MySQL 5.5.3
[phpmyadmin.git] / libraries / auth / config.auth.lib.php
blobe90e0bf795d0bdf76deb85e0a599a75124a70cbf
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).
6 * @package phpMyAdmin-Auth-Config
7 */
10 /**
11 * Displays authentication form
13 * @return boolean always true
15 * @access public
17 function PMA_auth()
19 return true;
20 } // end of the 'PMA_auth()' function
23 /**
24 * Gets advanced authentication settings
26 * @return boolean always true
28 * @access public
30 function PMA_auth_check()
32 return true;
33 } // end of the 'PMA_auth_check()' function
36 /**
37 * Set the user and password after last checkings if required
39 * @return boolean always true
41 * @access public
43 function PMA_auth_set_user()
45 return true;
46 } // end of the 'PMA_auth_set_user()' function
49 /**
50 * User is not allowed to login to MySQL -> authentication failed
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
63 * @return boolean always true (no return indeed)
65 * @access public
67 function PMA_auth_fails()
69 $conn_error = PMA_DBI_getError();
70 if (!$conn_error) {
71 $conn_error = __('Cannot connect: invalid settings.');
74 // Defines the charset to be used
75 header('Content-Type: text/html; charset=utf-8');
76 /* HTML header */
77 $page_title = __('Access denied');
78 require './libraries/header_meta_style.inc.php';
80 </head>
82 <body>
83 <br /><br />
84 <center>
85 <h1><?php echo sprintf(__('Welcome to %s'), ' phpMyAdmin '); ?></h1>
86 </center>
87 <br />
88 <table border="0" cellpadding="0" cellspacing="3" align="center" width="80%">
89 <tr>
90 <td>
92 <?php
93 $GLOBALS['is_header_sent'] = true;
95 if (isset($GLOBALS['allowDeny_forbidden']) && $GLOBALS['allowDeny_forbidden']) {
96 trigger_error(__('Access denied'), E_USER_NOTICE);
97 } else {
98 // Check whether user has configured something
99 if ($GLOBALS['PMA_Config']->source_mtime == 0) {
100 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";
101 } elseif (!isset($GLOBALS['errno']) || (isset($GLOBALS['errno']) && $GLOBALS['errno'] != 2002) && $GLOBALS['errno'] != 2003) {
102 // if we display the "Server not responding" error, do not confuse users
103 // by telling them they have a settings problem
104 // (note: it's true that they could have a badly typed host name, but
105 // anyway the current message tells that the server
106 // rejected the connection, which is not really what happened)
107 // 2002 is the error given by mysqli
108 // 2003 is the error given by mysql
109 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);
111 PMA_mysqlDie($conn_error, '', true, '', false);
113 $GLOBALS['error_handler']->dispUserErrors();
115 </td>
116 </tr>
117 <?php
118 if (count($GLOBALS['cfg']['Servers']) > 1) {
119 // offer a chance to login to other servers if the current one failed
120 require_once './libraries/select_server.lib.php';
121 echo '<tr>' . "\n";
122 echo ' <td>' . "\n";
123 PMA_select_server(true, true);
124 echo ' </td>' . "\n";
125 echo '</tr>' . "\n";
127 echo '</table>' . "\n";
128 require './libraries/footer.inc.php';
129 return true;
130 } // end of the 'PMA_auth_fails()' function