From 97807b0f9fdc48fcb4251c0a860ea286f6fb336c Mon Sep 17 00:00:00 2001 From: jakubvrana Date: Mon, 22 Jun 2009 05:22:41 +0000 Subject: [PATCH] Comments git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@749 7c3ca157-0c34-0410-bff1-cbf682f78f5c --- adminer/user.inc.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/adminer/user.inc.php b/adminer/user.inc.php index 7141ada1..6cb43f84 100644 --- a/adminer/user.inc.php +++ b/adminer/user.inc.php @@ -54,7 +54,7 @@ if (isset($_GET["host"]) && ($result = $dbh->query("SHOW GRANTS FOR " . $dbh->qu if ($_POST && !$error) { $old_user = (isset($_GET["host"]) ? $dbh->quote($_GET["user"]) . "@" . $dbh->quote($_GET["host"]) : "''"); - $new_user = $dbh->quote($_POST["user"]) . "@" . $dbh->quote($_POST["host"]); + $new_user = $dbh->quote($_POST["user"]) . "@" . $dbh->quote($_POST["host"]); // if $_GET["host"] is not set then $new_user is always different $pass = $dbh->quote($_POST["pass"]); if ($_POST["drop"]) { query_redirect("DROP USER $old_user", $SELF . "privileges=", lang('User has been dropped.')); @@ -102,6 +102,7 @@ if ($_POST && !$error) { } query_redirect(queries(), $SELF . "privileges=", (isset($_GET["host"]) ? lang('User has been altered.') : lang('User has been created.')), !$error, false, $error); if ($old_user != $new_user) { + // delete new user in case of an error $dbh->query("DROP USER $new_user"); } }