Once a query has been executed phpMyAdmin now moves back to the calling script

This commit is contained in:
Loïc Chapeaux
2001-08-19 12:13:03 +00:00
parent 59c3fc6b90
commit 4d0b6c3a3c
4 changed files with 84 additions and 32 deletions

View File

@@ -8,6 +8,18 @@
require('./grab_globals.inc.php3');
if (!isset($message)) {
include('./header.inc.php3');
// Reloads the navigation frame via JavaScript if required
if (!empty($reload) && $reload == 'true') {
echo "\n";
?>
<script type="text/javascript" language="javascript1.2">
<!--
window.parent.frames['nav'].location.replace('./left.php3?lang=<?php echo $lang; ?>&server=<?php echo $server; ?>&db=<?php echo urlencode($db); ?>');
//-->
</script>
<?php
}
echo "\n";
} else {
show_message($message);
}

View File

@@ -121,12 +121,16 @@ if ($sql_query != '') {
/**
* Go back to db_details.php3
* Go back to the calling script
*/
include('./header.inc.php3');
require('./header.inc.php3');
if (isset($my_die)) {
mysql_die('', $my_die);
}
$message = $strSuccess;
require('./db_details.php3');
if (!isset($goto)
|| ($goto != 'db_details.php3' && $goto != 'tbl_properties.php3')) {
$goto = 'db_details.php3';
}
require('./' . $goto);
?>

View File

@@ -519,7 +519,11 @@ window.parent.frames['nav'].location.replace('./left.php3?lang=<?php echo $GLOBA
$query_base = htmlspecialchars($GLOBALS['sql_query']);
$query_base = ereg_replace("(\015\012)|(\015)|(\012)", $new_line, $query_base);
if (!isset($GLOBALS['show_query']) || $GLOBALS['show_query'] != 'y') {
$edit_link = '<a href="db_details.php3?lang=' . $GLOBALS['lang'] . '&server=' . urlencode($GLOBALS['server']) . '&db=' . urlencode($GLOBALS['db']) . '&sql_query=' . urlencode($GLOBALS['sql_query']) . '&show_query=y">' . $GLOBALS['strEdit'] . '</a>';
if (isset($GLOBALS['goto']) && $GLOBALS['goto'] == 'tbl_properties.php3') {
$edit_link = '<a href="tbl_properties.php3?lang=' . $GLOBALS['lang'] . '&server=' . urlencode($GLOBALS['server']) . '&db=' . urlencode($GLOBALS['db']) . '&table=' . urlencode($GLOBALS['table']) . '&sql_query=' . urlencode($GLOBALS['sql_query']) . '&show_query=y">' . $GLOBALS['strEdit'] . '</a>';
} else {
$edit_link = '<a href="db_details.php3?lang=' . $GLOBALS['lang'] . '&server=' . urlencode($GLOBALS['server']) . '&db=' . urlencode($GLOBALS['db']) . '&sql_query=' . urlencode($GLOBALS['sql_query']) . '&show_query=y">' . $GLOBALS['strEdit'] . '</a>';
}
echo ' ' . $GLOBALS['strSQLQuery'] . '&nbsp;:&nbsp;[' . $edit_link . ']<br />' . "\n";
} else {
echo ' ' . $GLOBALS['strSQLQuery'] . '&nbsp;:<br />' . "\n";
@@ -691,16 +695,14 @@ window.parent.frames['nav'].location.replace('./left.php3?lang=<?php echo $GLOBA
}
// ... and now in form "departments d"
if ($data_count >= 2) {
$sql = eregi_replace(
'([^a-zA-Z0-9])'.$data[1].'\.',
'\1 '.$data[0].'.',
$sql);
$sql = eregi_replace(
'([^a-zA-Z0-9])' . $data[1] . '\.',
'\1 ' . $data[0] . '.',
$sql);
if (!isset($match)) {
$match = $data[0].' '.$data[1];
$match = $data[0] . ' ' . $data[1];
}
$sql = str_replace($match,' '.$data[0],$sql);
$sql = str_replace($match, ' ' . $data[0], $sql);
} // end if
} // end while

View File

@@ -12,13 +12,45 @@ if (!isset($message)) {
} else {
show_message($message);
}
/**
* Defines the query to be displayed in the query textarea
*/
if (isset($show_query) && $show_query == 'y') {
// This script has been called by db_readdump.php3
if (isset($sql_query_cpy)) {
$query_to_display = $sql_query_cpy;
}
// Other cases
else if (get_magic_quotes_gpc()) {
$query_to_display = stripslashes($sql_query);
}
else {
$query_to_display = $sql_query;
}
} else {
$query_to_display = '';
}
unset($sql_query);
/**
* Selects the db that will be used during this script execution
*/
mysql_select_db($db) or mysql_die();
// mysql_select_db($db) or mysql_die();
$is_db = @mysql_select_db($db);
// Not a valid db name -> back to the welcome page
if (!$is_db) {
header('Location: main.php3?lang=' . $lang . '&server=' . $server . '&reload=true');
exit();
}
$is_table = @mysql_query('SHOW TABLES LIKE \'' . sql_addslashes($table, TRUE) . '\'');
// Not a valid table name -> back to the db_details.php3
if (!@mysql_numrows($is_table)) {
header('Location: db_details.php3?lang=' . $lang . '&server=' . $server . '&db=' . urlencode($db) . '&reload=true');
exit();
}
/**
@@ -30,6 +62,7 @@ $url_query = 'lang=' . $lang
. '&table=' . urlencode($table)
. '&goto=tbl_properties.php3';
/**
* Gets table informations
*/
@@ -52,17 +85,16 @@ if (MYSQL_MAJOR_VERSION >= 3.23 && intval(MYSQL_MINOR_VERSION) >= 3) {
$result = mysql_query('ALTER TABLE ' . backquote($table) . 'ORDER BY ' . $order_field) or mysql_die();
}
// Get table type and comments
// Get table type and comments and displays first browse links
$result = mysql_query('SHOW TABLE STATUS LIKE \'' . sql_addslashes($table, TRUE) . '\'') or mysql_die();
$showtable = mysql_fetch_array($result);
$tbl_type = strtoupper($showtable['Type']);
if (isset($showtable['Rows']) && $showtable['Rows']>0) {
?>
<!-- first browse links -->
<p>
if (isset($showtable['Rows']) && $showtable['Rows'] > 0) {
echo "\n";
?>
<!-- first browse links -->
<p>
[ <a href="sql.php3?<?php echo $url_query; ?>&sql_query=<?php echo urlencode('SELECT * FROM ' . backquote($table)); ?>&pos=0">
<b><?php echo $strBrowse; ?></b></a> ]&nbsp;&nbsp;&nbsp;
[ <a href="tbl_select.php3?<?php echo $url_query; ?>">
@@ -72,23 +104,21 @@ if (MYSQL_MAJOR_VERSION >= 3.23 && intval(MYSQL_MINOR_VERSION) >= 3) {
[ <a href="sql.php3?<?php echo $url_query; ?>&sql_query=<?php echo urlencode('DELETE FROM ' . backquote($table)); ?>&zero_rows=<?php echo urlencode($strTable . ' ' . htmlspecialchars($table) . ' ' . $strHasBeenEmptied); ?>">
<b><?php echo $strEmpty; ?></b></a> ]
</p>
<?php
<?php
} else {
?>
echo "\n";
?>
<!-- first browse links -->
<p>
<p>
[ <b><?php echo $strBrowse; ?></b> ]&nbsp;&nbsp;&nbsp;
[ <b><?php echo $strSelect; ?></b> ]&nbsp;&nbsp;&nbsp;
[ <a href="tbl_change.php3?<?php echo $url_query; ?>">
<b><?php echo $strInsert; ?></b></a> ]&nbsp;&nbsp;&nbsp;
[ <b><?php echo $strEmpty; ?></b> ]
</p>
<?php
}
<?php
}
echo "\n";
if (!empty($showtable['Comment'])) {
$show_comment = $showtable['Comment'];
@@ -519,13 +549,17 @@ var errorMsg2 = '<?php echo(str_replace('\'', '\\\'', $strNotValidNumber)); ?>';
<input type="hidden" name="lang" value="<?php echo $lang; ?>" />
<input type="hidden" name="pos" value="0" />
<input type="hidden" name="db" value="<?php echo $db; ?>" />
<input type="hidden" name="goto" value="db_details.php3" />
<input type="hidden" name="table" value="<?php echo $table; ?>" />
<input type="hidden" name="goto" value="tbl_properties.php3" />
<input type="hidden" name="zero_rows" value="<?php echo $strSuccess; ?>" />
<input type="hidden" name="prev_sql_query" value="<?php echo ((!empty($query_to_display)) ? urlencode($query_to_display) : ''); ?>" />
<?php echo $strRunSQLQuery . htmlspecialchars($db) . ' ' . show_docu('manual_Reference.html#SELECT'); ?>&nbsp;:<br />
<div style="margin-bottom: 5px">
<textarea name="sql_query" rows="<?php echo $cfgTextareaRows; ?>" cols="<?php echo $cfgTextareaCols; ?>" wrap="virtual">
SELECT * FROM <?php echo backquote($table); ?> WHERE 1
<?php echo ((!empty($query_to_display)) ? htmlspecialchars($query_to_display) : 'SELECT * FROM ' . backquote($table) . ' WHERE 1'); ?>
</textarea><br />
<input type="checkbox" name="show_query" value="y" checked="checked" />&nbsp;
<?php echo $strShowThisQuery; ?><br />
</div>
<?php
// Bookmark Support
@@ -939,7 +973,7 @@ else { // MySQL < 3.23
<!-- Deletes the table -->
<li>
<a href="sql.php3?<?php echo $url_query; ?>&goto=db_details.php3&reload=true&sql_query=<?php echo urlencode('DROP TABLE ' . backquote($table)); ?>&zero_rows=<?php echo urlencode($strTable . ' ' . htmlspecialchars($table) . ' ' . $strHasBeenDropped); ?>">
<a href="sql.php3?<?php echo ereg_replace('tbl_properties.php3$', 'db_details.php3', $url_query); ?>&reload=true&sql_query=<?php echo urlencode('DROP TABLE ' . backquote($table)); ?>&zero_rows=<?php echo urlencode($strTable . ' ' . htmlspecialchars($table) . ' ' . $strHasBeenDropped); ?>">
<?php echo $strDrop . ' ' . htmlspecialchars($table); ?></a>
</li>