From d60dd7d38c654bd758272e9ef784221a5bc51f3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Chapeaux?= Date: Mon, 20 Aug 2001 14:54:00 +0000 Subject: [PATCH] Previous version were buggy (my fault, sorry) --- lib.inc.php3 | 12 ++++++++---- sql.php3 | 10 +++++----- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/lib.inc.php3 b/lib.inc.php3 index d3033be2d..0a7723465 100755 --- a/lib.inc.php3 +++ b/lib.inc.php3 @@ -928,7 +928,7 @@ var errorMsg2 = ' $total) ? $total : $pos_next; + $lastShownRec = ($pos_next > $total) ? $total : $pos_next; show_message($GLOBALS['strShowingRecords'] . " $pos - $lastShownRec ($total " . $GLOBALS['strTotal'] . $selectstring . ')'); } else { show_message($GLOBALS['strSQLQuery']); @@ -940,7 +940,8 @@ var errorMsg2 = 'table; } mysql_field_seek($dt_result, 0); - if (!$is_simple) { + if (!$is_simple + && (!isset($SelectNumRows) || $SelectNumRows > $GLOBALS['cfgMaxRows'])) { show_table_navigation($pos_next, $pos_prev, $dt_result); } else { echo "\n" . '

' . "\n"; @@ -1186,12 +1187,15 @@ var errorMsg2 = ' +
'; + if (!$is_simple + && (!isset($SelectNumRows) || $SelectNumRows > $GLOBALS['cfgMaxRows'])) { show_table_navigation($pos_next, $pos_prev, $dt_result); + } else { + echo "\n" . '
' . "\n"; } } // end of the 'display_table()' function diff --git a/sql.php3 b/sql.php3 index 2050dee8e..5781024bd 100755 --- a/sql.php3 +++ b/sql.php3 @@ -63,6 +63,7 @@ $do_confirm = ($cfgConfirm && !isset($btnDrop) && eregi('DROP +(TABLE|DATABASE)|ALTER TABLE +[[:alnum:]_`]* +DROP|DELETE FROM', $sql_query)); $is_select = eregi('^SELECT ', $sql_query); +$is_count = ($is_select && eregi('^SELECT COUNT\((.*\.+)?\*\) FROM ', $sql_query)); $is_delupd = eregi('^(DELETE|UPDATE) ', $sql_query); @@ -117,7 +118,7 @@ else { $cfgMaxRows = $sessionMaxRows; } $sql_limit_to_append = (isset($pos) - && ($is_select && !eregi('^SELECT COUNT\((.*\.+)?\*\) FROM ', $sql_query)) + && ($is_select && !$is_count) && !eregi(' LIMIT[ 0-9,]+$', $sql_query)) ? " LIMIT $pos, $cfgMaxRows" : ''; @@ -193,6 +194,9 @@ else { } include('./header.inc.php3'); // Defines the display mode if it wasn't passed by url + if ($is_count) { + $display = 'simple'; + } if (!isset($display)) { $display = eregi('^((SHOW (VARIABLES|PROCESSLIST|STATUS|TABLE|GRANTS|CREATE|LOGS))|((CHECK|ANALYZE|REPAIR|OPTIMIZE) TABLE ))', $sql_query, $which); if (!empty($which[2]) && !empty($which[3])) { @@ -201,10 +205,6 @@ else { $display = 'bkmOnly'; } } - if ($display != 'simple' - && (isset($SelectNumRows) && $SelectNumRows <= $cfgMaxRows)) { - $display = 'simple'; - } // Displays the results in a table display_table($result, ($display == 'simple' || $display == 'bkmOnly'));