]> git.joonet.de Git - adminer.git/commitdiff
Save to history before session close
authorjakubvrana <jakubvrana@7c3ca157-0c34-0410-bff1-cbf682f78f5c>
Wed, 9 Sep 2009 15:51:26 +0000 (15:51 +0000)
committerjakubvrana <jakubvrana@7c3ca157-0c34-0410-bff1-cbf682f78f5c>
Wed, 9 Sep 2009 15:51:26 +0000 (15:51 +0000)
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@1076 7c3ca157-0c34-0410-bff1-cbf682f78f5c

adminer/sql.inc.php

index 4e6a2292200b0eec4150923bf258c995ecc63cf5..fce587c4cfa58b6cf9abef3bb7126035509c2156 100644 (file)
@@ -23,13 +23,13 @@ if (!$error && $_POST) {
                $space = "(\\s|/\\*.*\\*/|(#|-- )[^\n]*\n|--\n)";
                $alter_database = "(CREATE|DROP)$space+(DATABASE|SCHEMA)\\b~isU";
                $databases = &$_SESSION["databases"][$_GET["server"]];
+               if (!$fp && strlen($query) && (!$history || end($history) != $query)) { // don't add repeated 
+                       $history[] = $query;
+               }
                if (isset($databases) && !preg_match("~\\b$alter_database", $query)) { // quick check - may be inside string
                        //! false positive with $fp
                        session_write_close();
                }
-               if (!$fp && strlen($query) && (!$history || end($history) != $query)) { // don't add repeated 
-                       $history[] = $query;
-               }
                $delimiter = ";";
                $offset = 0;
                $empty = true;
@@ -109,7 +109,7 @@ if (!$error && $_POST) {
 ?>
 
 <form action="" method="post" enctype="multipart/form-data">
-<p><textarea name="query" rows="20" cols="80" style="width: 98%;"><?php echo h($_POST ? $_POST["query"] : (strlen($_GET["history"]) ? $_SESSION["history"][$_GET["server"]][DB][$_GET["history"]] : $_GET["sql"])); ?></textarea>
+<p><textarea name="query" rows="20" cols="80" style="width: 98%;"><?php echo h($_POST ? $_POST["query"] : (strlen($_GET["history"]) ? $history[$_GET["history"]] : $_GET["sql"])); ?></textarea>
 <p>
 <input type="hidden" name="token" value="<?php echo $token; ?>">
 <input type="submit" value="<?php echo lang('Execute'); ?>">