9086c9ad77db90633e0629e9e86a88366265ded0
Bernd Wurst Neue MySQL-Verwaltung

Bernd Wurst authored 11 years ago

1) <?php
2) /*
3) This file belongs to the Webinterface of schokokeks.org Hosting
4) 
Bernd Wurst Copyright year update

Bernd Wurst authored 6 years ago

5) Written 2008-2018 by schokokeks.org Hosting, namely
Bernd Wurst Neue MySQL-Verwaltung

Bernd Wurst authored 11 years ago

6)   Bernd Wurst <bernd@schokokeks.org>
7)   Hanno Böck <hanno@schokokeks.org>
8) 
9) 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.
10) 
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

11) You should have received a copy of the CC0 Public Domain Dedication along with this software. If not, see
Bernd Wurst Neue MySQL-Verwaltung

Bernd Wurst authored 11 years ago

12) http://creativecommons.org/publicdomain/zero/1.0/
13) 
14) 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.
15) */
16) 
17) require_once('session/start.php');
18) require_once('inc/icons.php');
19) require_role(array(ROLE_SYSTEMUSER));
20) 
21) global $prefix;
22) 
23) require_once('mysql.php');
24) 
25) $dbs = get_mysql_databases($_SESSION['userinfo']['uid']);
26) $users = get_mysql_accounts($_SESSION['userinfo']['uid']);
27) $username = $_SESSION['userinfo']['username'];
28) 
29) $section = 'mysql_overview';
30) title('Neue MySQL-Datenbank');
31) 
32) $dbnames = array();
33) foreach ($dbs as $db) {
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

34)     $dbnames[] = $db['name'];
Bernd Wurst Neue MySQL-Verwaltung

Bernd Wurst authored 11 years ago

35) }
36) 
37) $suggestion = $username.'_1';
38) $count = 2;
39) while (in_array($suggestion, $dbnames)) {
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

40)     $suggestion = $username.'_'.$count;
41)     $count++;
Bernd Wurst Neue MySQL-Verwaltung

Bernd Wurst authored 11 years ago

42) }
43) 
Bernd Wurst Zeige deutlich an, welche M...

Bernd Wurst authored 10 years ago

44) $hint = 'Der Datenbankname muss mit <strong>'.$username.'_</strong> beginnen.';
45) 
Bernd Wurst Neue MySQL-Verwaltung

Bernd Wurst authored 11 years ago

46) $form = '<h4>Name der neuen Datenbank</h4>
47) <input type="text" name="newdb" value="'.$suggestion.'" />
Bernd Wurst Zeige deutlich an, welche M...

Bernd Wurst authored 10 years ago

48) <p>Bitte nur Kleinbuchstaben, Zahlen und Unterstrich verwenden. '.$hint.'</p>
Bernd Wurst Neue MySQL-Verwaltung

Bernd Wurst authored 11 years ago

49) <p><label for="description">Optionale Beschreibung dieser Datenbank:</label> <input type="text" name="description" id="description" /></p>
50) ';
51) if (count(additional_servers()) > 0) {
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

52)     $form .= '<h4>Server</h4>';
53)     $form .= '<p>Auf welchem Server soll diese Datenbank eingerichtet werden?</p>';
54)     $available_servers = additional_servers();
55)     $available_servers[] = my_server_id();
56)     $available_servers = array_unique($available_servers);
Hanno remove whitespace in empty...

Hanno authored 6 years ago

57) 
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

58)     $selectable_servers = array();
59)     $all_servers = server_names();
60)     foreach ($all_servers as $id => $fqdn) {
61)         if (in_array($id, $available_servers)) {
62)             $selectable_servers[$id] = $fqdn;
63)         }
Bernd Wurst Neue MySQL-Verwaltung

Bernd Wurst authored 11 years ago

64)     }
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

65)     $form .= html_select('server', $selectable_servers, my_server_id());
66)     $form .= '<p>Alle Benutzer die auf diese Datenbank zugreifen dürfen, werden automatisch auf dem passenden Server eingerichtet</p>';
Bernd Wurst Neue MySQL-Verwaltung

Bernd Wurst authored 11 years ago

67) }
68) if (count($users) > 0) {
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

69)     $form .= '<h4>Berechtigungen</h4>';
70)     $form .= '<p>Welche der bisher vorhandenen Datenbank-Benutzer dürfen auf diese Datenbank zugreifen?</p>';
71)     foreach ($users as $user) {
72)         $form .= '<p><input type="checkbox" id="access_'.$user['username'].'" name="access[]" value="'.$user['username'].'" /> <label for="access_'.$user['username'].'">'.$user['username'].'</label></p>';
73)     }
Bernd Wurst Neue MySQL-Verwaltung

Bernd Wurst authored 11 years ago

74) }
Hanno remove whitespace in empty...

Hanno authored 6 years ago

75)