Hanno Böck To the extent possible under law, the author(s) have dedicated all copyright and related and neighboring rights to this software to the public domain worldwide. This software is distributed without any warranty. You should have received a copy of the CC0 Public Domain Dedication along with this software. If not, see http://creativecommons.org/publicdomain/zero/1.0/ Nevertheless, in case you use a significant part of this code, we ask (but not require, see the license) that you keep the authors' names in place and return your changes to the public. We would be especially happy if you tell us what you're going to do with this code. */ require_once('session/start.php'); require_once('inc/icons.php'); require_role([ROLE_SYSTEMUSER]); global $prefix; require_once('mysql.php'); $dbs = get_mysql_databases($_SESSION['userinfo']['uid']); $users = get_mysql_accounts($_SESSION['userinfo']['uid']); $username = $_SESSION['userinfo']['username']; $section = 'mysql_overview'; title('Neue MySQL-Datenbank'); $dbnames = []; foreach ($dbs as $db) { $dbnames[] = $db['name']; } $suggestion = $username.'_1'; $count = 2; while (in_array($suggestion, $dbnames)) { $suggestion = $username.'_'.$count; $count++; } $hint = 'Der Datenbankname muss mit '.$username.'_ beginnen.'; $form = '

Name der neuen Datenbank

Bitte nur Kleinbuchstaben, Zahlen und Unterstrich verwenden. '.$hint.'

'; if (count(additional_servers()) > 0) { $form .= '

Server

'; $form .= '

Auf welchem Server soll diese Datenbank eingerichtet werden?

'; $available_servers = additional_servers(); $available_servers[] = my_server_id(); $available_servers = array_unique($available_servers); $selectable_servers = []; $all_servers = server_names(); foreach ($all_servers as $id => $fqdn) { if (in_array($id, $available_servers)) { $selectable_servers[$id] = $fqdn; } } $form .= html_select('server', $selectable_servers, my_server_id()); $form .= '

Alle Benutzer die auf diese Datenbank zugreifen dürfen, werden automatisch auf dem passenden Server eingerichtet

'; } if (count($users) > 0) { $form .= '

Berechtigungen

'; $form .= '

Welche der bisher vorhandenen Datenbank-Benutzer dürfen auf diese Datenbank zugreifen?

'; foreach ($users as $user) { $form .= '

'; } } $form .= '

'; output(html_form('mysql_newdb', 'save', 'action=newdb', $form));