$error) {
if ( $i == 0 ) {
$error_msg = $error;
} else {
$error_msg = $error_msg.", ".$error;
}
}
$_SESSION['error_msg'] = "Error: field ".$error_msg." can not be blank.";
} else {
// Add Database
$v_type = escapeshellarg($_POST['v_type']);
$v_charset = escapeshellarg($_POST['v_charset']);
exec (VESTA_CMD."v_add_database ".$user." ".$v_database." ".$v_dbuser." ".$v_password." ".$v_type." 'default' ".$v_charset, $output, $return_var);
$v_type = $_POST['v_type'];
$v_charset = $_POST['v_charset'];
if ($return_var != 0) {
$error = implode('
', $output);
if (empty($error)) $error = 'Error: vesta did not return any output.';
$_SESSION['error_msg'] = $error;
unset($v_password);
unset($output);
} else {
$_SESSION['ok_msg'] = "OK: database ".$user."_".$_POST['v_database']." has been created successfully.";
unset($v_database);
unset($v_dbuser);
unset($v_password);
unset($v_type);
unset($v_charset);
unset($output);
}
}
}
exec (VESTA_CMD."v_list_database_types 'json'", $output, $return_var);
$db_types = json_decode(implode('', $output), true);
unset($output);
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/menu_add_db.html');
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/add_db.html');
unset($_SESSION['error_msg']);
unset($_SESSION['ok_msg']);
//}
// Footer
include($_SERVER['DOCUMENT_ROOT'].'/templates/footer.html');