diff --git a/adminer/database.inc.php b/adminer/database.inc.php index 6800d0e5..b13b1b26 100644 --- a/adminer/database.inc.php +++ b/adminer/database.inc.php @@ -2,10 +2,12 @@ if ($_POST && !$error && !isset($_POST["add_x"])) { // add is an image and PHP changes add.x to add_x restart_session(); if ($_POST["drop"]) { + $_GET["db"] = ""; // to save in global history queries_redirect(remove_from_uri("db|database"), lang('Database has been dropped.'), drop_databases(array(DB))); } elseif (DB !== $_POST["name"]) { // create or rename database if (DB != "") { + $_GET["db"] = $_POST["name"]; queries_redirect(preg_replace('~db=[^&]*&~', '', ME) . "db=" . urlencode($_POST["name"]), lang('Database has been renamed.'), rename_database($_POST["name"], $_POST["collation"])); } else { $dbs = explode("\n", str_replace("\r", "", $_POST["name"])); diff --git a/adminer/include/adminer.inc.php b/adminer/include/adminer.inc.php index 27b07d20..3564b93a 100644 --- a/adminer/include/adminer.inc.php +++ b/adminer/include/adminer.inc.php @@ -387,8 +387,11 @@ document.getElementById('username').focus(); restart_session(); $id = "sql-" . count($_SESSION["messages"]); $history = &get_session("history"); - $history[DB][] = (strlen($query) > 1e6 ? ereg_replace('[\x80-\xFF]+$', '', substr($query, 0, 1e6)) . "\n..." : $query); // [\x80-\xFF] - valid UTF-8, \n - can end by one-line comment - return " " . lang('SQL command') . "'; + $history[$_GET["db"]][] = (strlen($query) > 1e6 // not DB - reset in drop database + ? ereg_replace('[\x80-\xFF]+$', '', substr($query, 0, 1e6)) . "\n..." // [\x80-\xFF] - valid UTF-8, \n - can end by one-line comment + : $query + ); //! respect $_GET["ns"] + return " " . lang('SQL command') . "'; } /** Functions displayed in edit form