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('Neuer MySQL-Benutzer'); html_header(' '); $usernames = []; foreach ($users as $user) { $usernames[] = $user['username']; } $suggestion = $username; $count = 1; while (in_array($suggestion, $usernames)) { $suggestion = $username.'_'.$count; $count++; } $hint = 'Der MySQL-Benutzername muss entweder '.$username.' lauten oder mit '.$username.'_ beginnen.'; if (in_array($username, $usernames)) { $hint = 'Der MySQL-Benutzername muss mit '.$username.'_ beginnen.'; } $form = '

Benutzername

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

Aufgrund einer Einschränkung des MySQL-Servers dürfen Benutzernamen nur maximal 16 Zeichen lang sein.

Passwort

Automatisch erzeugtes Passwort:

Berechtigungen

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

Auf welche der bisher vorhandenen Datenbanken darf dieser Benutzer zugreifen?

'; foreach ($dbs as $db) { $desc = ''; if ($db['description']) { $desc = ' - '.$db['description'].''; } $form .= '

'; } } else { $form .= '

Bisher gibt es noch keine Datenbanken.

'; } $form .= '

'; output(html_form('mysql_newuser', 'save', 'action=newuser', $form));