git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@749 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
jakubvrana 2009-06-22 05:22:41 +00:00
parent 7b57b5d4b8
commit 97807b0f9f

View file

@ -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");
}
}