Previous version were buggy (my fault, sorry)

This commit is contained in:
Loïc Chapeaux
2001-08-20 14:54:00 +00:00
parent 75e7497367
commit d60dd7d38c
2 changed files with 13 additions and 9 deletions

View File

@@ -928,7 +928,7 @@ var errorMsg2 = '<?php echo(str_replace('\'', '\\\'', $GLOBALS['strNotValidNumbe
} else { } else {
$selectstring = ''; $selectstring = '';
} }
$lastShownRec = ($pos_next > $total) ? $total : $pos_next; $lastShownRec = ($pos_next > $total) ? $total : $pos_next;
show_message($GLOBALS['strShowingRecords'] . " $pos - $lastShownRec ($total " . $GLOBALS['strTotal'] . $selectstring . ')'); show_message($GLOBALS['strShowingRecords'] . " $pos - $lastShownRec ($total " . $GLOBALS['strTotal'] . $selectstring . ')');
} else { } else {
show_message($GLOBALS['strSQLQuery']); show_message($GLOBALS['strSQLQuery']);
@@ -940,7 +940,8 @@ var errorMsg2 = '<?php echo(str_replace('\'', '\\\'', $GLOBALS['strNotValidNumbe
$table = $field->table; $table = $field->table;
} }
mysql_field_seek($dt_result, 0); 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); show_table_navigation($pos_next, $pos_prev, $dt_result);
} else { } else {
echo "\n" . '<br /><br />' . "\n"; echo "\n" . '<br /><br />' . "\n";
@@ -1186,12 +1187,15 @@ var errorMsg2 = '<?php echo(str_replace('\'', '\\\'', $GLOBALS['strNotValidNumbe
} // end while } // end while
?> ?>
</table> </table>
<br />
<?php <?php
echo "\n"; echo "\n";
if (!$is_simple) { if (!$is_simple
echo '<br />'; && (!isset($SelectNumRows) || $SelectNumRows > $GLOBALS['cfgMaxRows'])) {
show_table_navigation($pos_next, $pos_prev, $dt_result); show_table_navigation($pos_next, $pos_prev, $dt_result);
} else {
echo "\n" . '<br />' . "\n";
} }
} // end of the 'display_table()' function } // end of the 'display_table()' function

View File

@@ -63,6 +63,7 @@ $do_confirm = ($cfgConfirm
&& !isset($btnDrop) && !isset($btnDrop)
&& eregi('DROP +(TABLE|DATABASE)|ALTER TABLE +[[:alnum:]_`]* +DROP|DELETE FROM', $sql_query)); && eregi('DROP +(TABLE|DATABASE)|ALTER TABLE +[[:alnum:]_`]* +DROP|DELETE FROM', $sql_query));
$is_select = eregi('^SELECT ', $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); $is_delupd = eregi('^(DELETE|UPDATE) ', $sql_query);
@@ -117,7 +118,7 @@ else {
$cfgMaxRows = $sessionMaxRows; $cfgMaxRows = $sessionMaxRows;
} }
$sql_limit_to_append = (isset($pos) $sql_limit_to_append = (isset($pos)
&& ($is_select && !eregi('^SELECT COUNT\((.*\.+)?\*\) FROM ', $sql_query)) && ($is_select && !$is_count)
&& !eregi(' LIMIT[ 0-9,]+$', $sql_query)) && !eregi(' LIMIT[ 0-9,]+$', $sql_query))
? " LIMIT $pos, $cfgMaxRows" ? " LIMIT $pos, $cfgMaxRows"
: ''; : '';
@@ -193,6 +194,9 @@ else {
} }
include('./header.inc.php3'); include('./header.inc.php3');
// Defines the display mode if it wasn't passed by url // Defines the display mode if it wasn't passed by url
if ($is_count) {
$display = 'simple';
}
if (!isset($display)) { if (!isset($display)) {
$display = eregi('^((SHOW (VARIABLES|PROCESSLIST|STATUS|TABLE|GRANTS|CREATE|LOGS))|((CHECK|ANALYZE|REPAIR|OPTIMIZE) TABLE ))', $sql_query, $which); $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])) { if (!empty($which[2]) && !empty($which[3])) {
@@ -201,10 +205,6 @@ else {
$display = 'bkmOnly'; $display = 'bkmOnly';
} }
} }
if ($display != 'simple'
&& (isset($SelectNumRows) && $SelectNumRows <= $cfgMaxRows)) {
$display = 'simple';
}
// Displays the results in a table // Displays the results in a table
display_table($result, ($display == 'simple' || $display == 'bkmOnly')); display_table($result, ($display == 'simple' || $display == 'bkmOnly'));