headers were sometimes missing before an error is displayed

This commit is contained in:
Loïc Chapeaux
2002-03-08 15:52:28 +00:00
parent 6baffcd302
commit 736e7faa3a
4 changed files with 20 additions and 2 deletions

View File

@@ -13,6 +13,9 @@ $Source$
Lu<4C>s V. <luis.v at mail.pt>. Lu<4C>s V. <luis.v at mail.pt>.
* lang/hebrew.inc.php3: updated thanks to * lang/hebrew.inc.php3: updated thanks to
Moran Zaltsman <sagi_nahor at hotmail.com>. Moran Zaltsman <sagi_nahor at hotmail.com>.
* header.inc.php3, lines 161-165; user_details.php3, lines 978-980;
libraries/common.lib.php3, lines 229-232: headers were sometimes missing
before an error is displayed.
2002-03-07 Marc Delisle <lem9@users.sourceforge.net> 2002-03-07 Marc Delisle <lem9@users.sourceforge.net>
* Documentation.html, config.inc.php3, libraries/common.lib.php3: * Documentation.html, config.inc.php3, libraries/common.lib.php3:

View File

@@ -157,4 +157,10 @@ if (isset($db)) {
echo '</h1>' . "\n"; echo '</h1>' . "\n";
} }
echo "\n"; echo "\n";
/**
* Sets a variable to remember headers have been sent
*/
$is_header_sent = TRUE;
?> ?>

View File

@@ -225,6 +225,11 @@ if (!defined('PMA_COMMON_LIB_INCLUDED')){
function PMA_mysqlDie($error_message = '', $the_query = '', function PMA_mysqlDie($error_message = '', $the_query = '',
$is_modify_link = TRUE, $back_url = '') $is_modify_link = TRUE, $back_url = '')
{ {
if (empty($GLOBALS['is_header_sent'])) {
include('./header.inc.php3');
}
if (!$error_message) { if (!$error_message) {
$error_message = mysql_error(); $error_message = mysql_error();
} }
@@ -232,7 +237,7 @@ if (!defined('PMA_COMMON_LIB_INCLUDED')){
$the_query = $GLOBALS['sql_query']; $the_query = $GLOBALS['sql_query'];
} }
echo '<b>'. $GLOBALS['strError'] . '</b>' . "\n"; echo '<p><b>'. $GLOBALS['strError'] . '</b></p>' . "\n";
// if the config password is wrong, or the MySQL server does not // if the config password is wrong, or the MySQL server does not
// respond, do not show the query that would reveal the // respond, do not show the query that would reveal the
// username/password // username/password

View File

@@ -975,7 +975,11 @@ function PMA_confirm($the_host, $the_user) {
*/ */
$result = @mysql_query('USE mysql'); $result = @mysql_query('USE mysql');
if (mysql_error()) { if (mysql_error()) {
PMA_mysqlDie($GLOBALS['strNoRights'], '', FALSE, ''); include('./header.inc.php3');
echo '<p><b>' . $strError . '</b></p>' . "\n";
echo '<p>&nbsp;&nbsp;&nbsp;&nbsp;' . $strNoRights . '</p>' . "\n";
include('./footer.inc.php3');
exit();
} }
$result = @mysql_query('SELECT COUNT(Password) FROM mysql.user'); $result = @mysql_query('SELECT COUNT(Password) FROM mysql.user');
$password_field = (mysql_result($result, 0) ? 'Password' : 'password'); $password_field = (mysql_result($result, 0) ? 'Password' : 'password');