fixed a bug with headers that may be sent after output
This commit is contained in:
@@ -26,6 +26,7 @@ $err_url = 'db_details.php3'
|
|||||||
* Ensures the database exists (else move to the "parent" script) and diplays
|
* Ensures the database exists (else move to the "parent" script) and diplays
|
||||||
* headers
|
* headers
|
||||||
*/
|
*/
|
||||||
|
if (!isset($is_db) || !$is_db) {
|
||||||
// Not a valid db name -> back to the welcome page
|
// Not a valid db name -> back to the welcome page
|
||||||
if (!empty($db)) {
|
if (!empty($db)) {
|
||||||
$is_db = @mysql_select_db($db);
|
$is_db = @mysql_select_db($db);
|
||||||
@@ -34,6 +35,8 @@ if (empty($db) || !$is_db) {
|
|||||||
header('Location: ' . $cfgPmaAbsoluteUri . 'main.php3?lang=' . $lang . '&server=' . $server . (isset($message) ? '&message=' . urlencode($message) : '') . '&reload=1');
|
header('Location: ' . $cfgPmaAbsoluteUri . 'main.php3?lang=' . $lang . '&server=' . $server . (isset($message) ? '&message=' . urlencode($message) : '') . '&reload=1');
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
} // end if (ensures db exists)
|
||||||
|
|
||||||
// Displays headers
|
// Displays headers
|
||||||
if (!isset($message)) {
|
if (!isset($message)) {
|
||||||
$js_to_run = 'functions.js';
|
$js_to_run = 'functions.js';
|
||||||
|
@@ -276,13 +276,52 @@ if ($sql_query != '') {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Go back to the calling script
|
* MySQL error
|
||||||
*/
|
*/
|
||||||
$js_to_run = 'functions.js';
|
|
||||||
require('./header.inc.php3');
|
|
||||||
if (isset($my_die)) {
|
if (isset($my_die)) {
|
||||||
|
$js_to_run = 'functions.js';
|
||||||
|
include('./header.inc.php3');
|
||||||
mysql_die('', $my_die, '', $err_url);
|
mysql_die('', $my_die, '', $err_url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Go back to the calling script
|
||||||
|
*/
|
||||||
|
// Checks for a valid target script
|
||||||
|
if (isset($table) && $table == '') {
|
||||||
|
unset($table);
|
||||||
|
}
|
||||||
|
if (isset($db) && $db == '') {
|
||||||
|
unset($db);
|
||||||
|
}
|
||||||
|
$is_db = $is_table = FALSE;
|
||||||
|
if ($goto == 'tbl_properties.php3') {
|
||||||
|
if (!isset($table)) {
|
||||||
|
$goto = 'db_details.php3';
|
||||||
|
} else {
|
||||||
|
$is_table = @mysql_query('SHOW TABLES LIKE \'' . sql_addslashes($table, TRUE) . '\'');
|
||||||
|
if (!@mysql_numrows($is_table)) {
|
||||||
|
$goto = 'db_details.php3';
|
||||||
|
unset($table);
|
||||||
|
}
|
||||||
|
} // end if... else...
|
||||||
|
}
|
||||||
|
if ($goto == 'db_details.php3') {
|
||||||
|
if (isset($table)) {
|
||||||
|
unset($table);
|
||||||
|
}
|
||||||
|
if (!isset($db)) {
|
||||||
|
$goto = 'main.php3';
|
||||||
|
} else {
|
||||||
|
$is_db = @mysql_select_db($db);
|
||||||
|
if (!$is_db) {
|
||||||
|
$goto = 'main.php3';
|
||||||
|
unset($db);
|
||||||
|
}
|
||||||
|
} // end if... else...
|
||||||
|
}
|
||||||
|
// Defines the message to be displayed
|
||||||
if (!empty($id_bookmark) && $action_bookmark == 2) {
|
if (!empty($id_bookmark) && $action_bookmark == 2) {
|
||||||
$message = $strBookmarkDeleted;
|
$message = $strBookmarkDeleted;
|
||||||
} else if (!isset($sql_query_cpy)) {
|
} else if (!isset($sql_query_cpy)) {
|
||||||
@@ -292,5 +331,12 @@ if (!empty($id_bookmark) && $action_bookmark == 2) {
|
|||||||
} else {
|
} else {
|
||||||
$message = $strSuccess;
|
$message = $strSuccess;
|
||||||
}
|
}
|
||||||
|
// Loads to target script
|
||||||
|
if ($goto == 'db_details.php3' || $goto == 'tbl_properties.php3') {
|
||||||
|
$js_to_run = 'functions.js';
|
||||||
|
}
|
||||||
|
if ($goto != 'main.php3') {
|
||||||
|
include('./header.inc.php3');
|
||||||
|
}
|
||||||
require('./' . $goto);
|
require('./' . $goto);
|
||||||
?>
|
?>
|
||||||
|
44
sql.php3
44
sql.php3
@@ -263,17 +263,6 @@ else {
|
|||||||
|
|
||||||
// No rows returned -> move back to the calling page
|
// No rows returned -> move back to the calling page
|
||||||
if ($num_rows < 1 || $is_affected) {
|
if ($num_rows < 1 || $is_affected) {
|
||||||
if (isset($strYes)) {
|
|
||||||
if (isset($table)
|
|
||||||
&& (eregi('DROP[[:space:]]+(IF EXISTS[[:space:]]+)?TABLE[[:space:]]+`?' . $table . '`?[[:space:]]*$', $sql_query))) {
|
|
||||||
unset($table);
|
|
||||||
}
|
|
||||||
if (isset($db)
|
|
||||||
&& (eregi('DROP[[:space:]]+(IF EXISTS[[:space:]]+)?DATABASE[[:space:]]+`?' . $db . '`?[[:space:]]*$', $sql_query))) {
|
|
||||||
unset($db);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($is_delete) {
|
if ($is_delete) {
|
||||||
$message = $strDeletedRows . ' ' . $num_rows;
|
$message = $strDeletedRows . ' ' . $num_rows;
|
||||||
} else if ($is_insert) {
|
} else if ($is_insert) {
|
||||||
@@ -288,9 +277,40 @@ else {
|
|||||||
|
|
||||||
if (file_exists('./' . $goto)) {
|
if (file_exists('./' . $goto)) {
|
||||||
$goto = ereg_replace('\.\.*', '.', $goto);
|
$goto = ereg_replace('\.\.*', '.', $goto);
|
||||||
if ($goto == 'db_details.php3' && !empty($table)) {
|
// Checks for a valid target script
|
||||||
|
if (isset($table) && $table == '') {
|
||||||
unset($table);
|
unset($table);
|
||||||
}
|
}
|
||||||
|
if (isset($db) && $db == '') {
|
||||||
|
unset($db);
|
||||||
|
}
|
||||||
|
$is_db = $is_table = FALSE;
|
||||||
|
if ($goto == 'tbl_properties.php3') {
|
||||||
|
if (!isset($table)) {
|
||||||
|
$goto = 'db_details.php3';
|
||||||
|
} else {
|
||||||
|
$is_table = @mysql_query('SHOW TABLES LIKE \'' . sql_addslashes($table, TRUE) . '\'');
|
||||||
|
if (!@mysql_numrows($is_table)) {
|
||||||
|
$goto = 'db_details.php3';
|
||||||
|
unset($table);
|
||||||
|
}
|
||||||
|
} // end if... else...
|
||||||
|
}
|
||||||
|
if ($goto == 'db_details.php3') {
|
||||||
|
if (isset($table)) {
|
||||||
|
unset($table);
|
||||||
|
}
|
||||||
|
if (!isset($db)) {
|
||||||
|
$goto = 'main.php3';
|
||||||
|
} else {
|
||||||
|
$is_db = @mysql_select_db($db);
|
||||||
|
if (!$is_db) {
|
||||||
|
$goto = 'main.php3';
|
||||||
|
unset($db);
|
||||||
|
}
|
||||||
|
} // end if... else...
|
||||||
|
}
|
||||||
|
// Loads to target script
|
||||||
if ($goto == 'db_details.php3' || $goto == 'tbl_properties.php3') {
|
if ($goto == 'db_details.php3' || $goto == 'tbl_properties.php3') {
|
||||||
$js_to_run = 'functions.js';
|
$js_to_run = 'functions.js';
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user