|
|
@@ -50,11 +50,16 @@ if (!empty($_POST['save'])) {
|
|
|
|
|
|
// Change database user
|
|
|
if (($v_dbuser != $_POST['v_dbuser']) && (empty($_SESSION['error_msg']))) {
|
|
|
- $v_dbuser = escapeshellarg($v_dbuser);
|
|
|
- exec(HESTIA_CMD."v-change-database-user ".$user." ".escapeshellarg($v_database)." ".$v_dbuser, $output, $return_var);
|
|
|
+ $cmd = implode(" ", array(
|
|
|
+ HESTIA_CMD . "v-change-database-user",
|
|
|
+ // $user is already shell-quoted
|
|
|
+ $user,
|
|
|
+ escapeshellarg($v_database),
|
|
|
+ escapeshellarg($_POST['v_dbuser']),
|
|
|
+ ));
|
|
|
+ exec($cmd, $output, $return_var);
|
|
|
check_return_code($return_var, $output);
|
|
|
unset($output);
|
|
|
- $v_dbuser = $_POST['v_dbuser'];
|
|
|
}
|
|
|
|
|
|
// Change database password
|
|
|
@@ -78,6 +83,11 @@ if (!empty($_POST['save'])) {
|
|
|
if (empty($_SESSION['error_msg'])) {
|
|
|
$_SESSION['ok_msg'] = _('Changes has been saved.');
|
|
|
}
|
|
|
+ // if the mysql username was changed, render_page() below will render with the OLD mysql username,
|
|
|
+ // to prvent that, make the browser refresh the page.
|
|
|
+ http_response_code(303);
|
|
|
+ header("Location: " . $_SERVER['REQUEST_URI']);
|
|
|
+ die();
|
|
|
}
|
|
|
|
|
|
// Render page
|