' . "\n";
echo '' . htmlspecialchars($stripped_sql_query) . ' ?
';
?>
left frame should be reloaded
if (!empty($reload) && eregi('^CREATE TABLE (.*)', $sql_query)) {
$reload = 'true';
}
if (isset($sessionMaxRows)) {
$cfgMaxRows = $sessionMaxRows;
}
$sql_limit_to_append = (isset($pos) && $is_select && !eregi(' LIMIT[ 0-9,]+$', $sql_query))
? " LIMIT $pos, $cfgMaxRows"
: '';
if (eregi('(.*)( PROCEDURE (.*)| FOR UPDATE| LOCK IN SHARE MODE)', $sql_query, $regs)) {
$full_sql_query = $regs[1] . $sql_limit_to_append . $regs[2];
} else {
$full_sql_query = $sql_query . $sql_limit_to_append;
}
// Executes the query
mysql_select_db($db);
$result = @mysql_query($full_sql_query);
// Displays an error message if required and stop parsing the script
if (mysql_error()) {
$error = mysql_error();
include('./header.inc.php3');
mysql_die($error, $full_sql_query);
}
// Gets the number of rows returned ('@' is required because mysql_num_rows
// ran on queries that are not 'SELECT' statements returns an error
$num_rows = @mysql_num_rows($result);
// Counts the total number of rows for the same 'SELECT' query without the
// 'LIMIT' clause that may have been programatically added
if (empty($sql_limit_to_append)) {
$SelectNumRows = $num_rows;
}
else if ($is_select) {
// reads only the from-part of the query...
$array = split(' from | FROM | order | ORDER | having | HAVING | limit | LIMIT | group by | GROUP BY', $sql_query);
if (!empty($array[1])) {
// ... and makes a count(*) to count the entries
$count_query = 'SELECT COUNT(*) AS count FROM ' . $array[1];
$OPresult = mysql_query($count_query);
if ($OPresult) {
$SelectNumRows = mysql_result($OPresult, 0, 'count');
}
} else {
$SelectNumRows = 0;
}
} // end rows total count
// No rows returned -> move back to the calling page
if ($num_rows < 1) {
if (file_exists('./' . $goto)) {
if ($is_delupd) {
$message = $strAffectedRows . ' ' . mysql_affected_rows();
} else if (!empty($zero_rows)) {
$message = $zero_rows;
} else {
$message = $strEmptyResultSet;
}
$goto = ereg_replace('\.\.*', '.', $goto);
if ($goto != 'main.php3') {
include('./header.inc.php3');
}
include('./' . $goto);
} // end if file_exist
else {
$message = $zero_rows;
header('Location: ' . $goto);
} // end else
exit();
} // end no rows returned
// At least one row is returned -> displays a table with results
else {
// Displays the headers
if (isset($show_query)) {
unset($show_query);
}
include('./header.inc.php3');
// Defines the display mode if it wasn't passed by url
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])) {
$display = 'simple';
} else if (!empty($which[4]) && !empty($which[5])) {
$display = 'bkmOnly';
}
}
// Displays the results in a table
display_table($result, ($display == 'simple' || $display == 'bkmOnly'));
if ($display != 'simple') {
// Insert a new row
if ($display != 'bkmOnly') {
$url_query = 'lang=' . $lang
. '&server=' . urlencode($server)
. '&db=' . urlencode($db)
. '&table=' . urlencode($table)
. '&pos=' . $pos
. '&sql_query=' . urlencode($sql_query)
. '&goto=' . urlencode($goto);
echo "\n\n";
echo '' . "\n";
echo '' . "\n";
echo ' ' . $strInsertNewRow . '' . "\n";
echo '
' . "\n";
} // end insert row
// Bookmark Support
if ($cfgBookmark['db'] && $cfgBookmark['table'] && empty($id_bookmark)
&& !empty($sql_query)) {
echo "\n";
?>