From 3315aacde9de83003589c930fe6cbc4cfa622239 Mon Sep 17 00:00:00 2001 From: Marc Delisle Date: Tue, 13 Apr 2004 18:59:22 +0000 Subject: [PATCH] bug 898484 IIS crash --- ChangeLog | 2 ++ libraries/common.lib.php | 29 +++++++++++++++++++++++++++++ libraries/defines.lib.php | 13 ++++++++++++- tbl_replace.php | 2 +- 4 files changed, 44 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index f3516aa4e..e80d8798d 100755 --- a/ChangeLog +++ b/ChangeLog @@ -9,6 +9,8 @@ $Source$ * libraries/relation.lib.php: bug 930445 when PMA_table_info not defined, thanks to Philippe Jausions (jausions) * Documentation.html: new faq links and cleanup, thanks to Cédric Corazza + * tbl_replace.php, libraries/defines.lib.php, /common.lib.php: + bug 898484, IIS crash: do not use header('Location: ') 2004-04-12 Marcel Tschopp * left.php, tbl_properties_structure.php, libraries/mysql_charsets.lib.php, diff --git a/libraries/common.lib.php b/libraries/common.lib.php index 8eab5abcc..5a8cb76fd 100644 --- a/libraries/common.lib.php +++ b/libraries/common.lib.php @@ -1085,6 +1085,35 @@ if ($is_minimum_common == FALSE) { echo $strHostEmpty; } + /** + * Send HTTP header, taking IIS limits into account + * ( 600 seems ok) + * + * @param string the header to send + * + * @return boolean always true + */ + function PMA_sendHeaderLocation($uri) + { + if (PMA_IS_IIS && strlen($uri) > 600) { + + echo '- - -' . "\n"; + echo '' . "\n"; + echo '' . "\n"; + echo '' . "\n"; + echo '' . "\n"; + echo '' . "\n"; + echo '' . "\n"; + echo ' ' . "\n"; + + } else { + header('Location: ' . $uri); + } + } + /** * Get the list and number of available databases. diff --git a/libraries/defines.lib.php b/libraries/defines.lib.php index 6c128bb4f..fe193f754 100644 --- a/libraries/defines.lib.php +++ b/libraries/defines.lib.php @@ -9,7 +9,8 @@ * PMA_PHP_INT_VERSION (int) - eg: 30017 instead of 3.0.17 or * 40006 instead of 4.0.6RC3 * PMA_IS_WINDOWS (bool) - mark if phpMyAdmin running on windows - * server + * PMA_IS_IIS (bool) - true is phpMyAdmin is running + * on Microsoft IIS server * PMA_IS_GD2 (bool) - true if GD2 is present * PMA_USR_OS (string) - the plateform (os) of the user * PMA_USR_BROWSER_AGENT (string) - the browser of the user @@ -49,6 +50,16 @@ if (!defined('PMA_IS_WINDOWS')) { } } +// Whether the Web server php is running on is IIS +if (!defined('PMA_IS_IIS')) { + if (isset($_SERVER['SERVER_SOFTWARE']) + && stristr($_SERVER['SERVER_SOFTWARE'], 'Microsoft/IIS')) { + define('PMA_IS_IIS', 1); + } else { + define('PMA_IS_IIS', 0); + } +} + function PMA_dl($module) { if (!isset($GLOBALS['PMA_dl_allowed'])) { if (!@ini_get('safe_mode') && @ini_get('enable_dl') && @function_exists('dl')) { diff --git a/tbl_replace.php b/tbl_replace.php index 063c6a673..6ecac8c8c 100644 --- a/tbl_replace.php +++ b/tbl_replace.php @@ -264,7 +264,7 @@ if ($is_gotofile) { // on the resulting page // Nijel: we also need to limit size of url... $add_query = (!$seen_binary && strlen($sql_query) < 1024 ? '&disp_query=' . urlencode($sql_query) : ''); - header('Location: ' . $cfg['PmaAbsoluteUri'] . $goto . '&disp_message=' . urlencode($message) . $add_query); + PMA_sendHeaderLocation($cfg['PmaAbsoluteUri'] . $goto . '&disp_message=' . urlencode($message) . $add_query); } exit(); ?>