Neue MySQL-Verwaltung
Bernd Wurst authored 11 years ago
|
1) <?php
2) /*
3) This file belongs to the Webinterface of schokokeks.org Hosting
4)
|
Lizenzinfos in eigenes Modu...
Bernd Wurst authored 10 years ago
|
5) Written 2008-2014 by schokokeks.org Hosting, namely
|
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)
11) You should have received a copy of the CC0 Public Domain Dedication along with this software. If not, see
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('Neuer MySQL-Benutzer');
31)
32)
33) html_header('
34) <script type="text/javascript">
35)
36) function makePasswd() {
37) var passwd = \'\';
38) var chars = \'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\';
39) for (i=0; i<15; i++) {
40) var c = Math.floor(Math.random()*chars.length + 1);
41) passwd += chars.charAt(c)
42) }
43) return passwd;
44) }
45)
46) function setRandomPassword()
47) {
48) pass = makePasswd();
49) document.getElementById(\'newpass\').value = pass;
50) document.getElementById(\'newpass_display\').value = pass;
51) document.getElementById(\'newpass_display\').parentNode.style.display = \'block\';
52) }
53) </script>');
54)
55)
56) $usernames = array();
57) foreach ($users as $user) {
58) $usernames[] = $user['username'];
59) }
60)
61) $suggestion = $username;
62) $count = 1;
63) while (in_array($suggestion, $usernames)) {
64) $suggestion = $username.'_'.$count;
65) $count++;
66) }
67)
|
Zeige deutlich an, welche M...
Bernd Wurst authored 10 years ago
|
68) $hint = 'Der MySQL-Benutzername muss entweder <strong>'.$username.'</strong> lauten oder mit <strong>'.$username.'_</strong> beginnen.';
69) if (in_array($username, $usernames)) {
70) $hint = 'Der MySQL-Benutzername muss mit <strong>'.$username.'_</strong> beginnen.';
71) }
72)
73)
|
Neue MySQL-Verwaltung
Bernd Wurst authored 11 years ago
|
74) $form = '<h4>Benutzername</h4>
75) <input type="text" name="newuser" value="'.$suggestion.'" maxlength="16" />
|
Zeige deutlich an, welche M...
Bernd Wurst authored 10 years ago
|
76) <p>Bitte nur Kleinbuchstaben, Zahlen und Unterstrich verwenden. '.$hint.'</p>
|
Neue MySQL-Verwaltung
Bernd Wurst authored 11 years ago
|
77) <p>Aufgrund einer Einschränkung des MySQL-Servers dürfen Benutzernamen nur maximal 16 Zeichen lang sein.</p>
78) <p><label for="description">Optionale Beschreibung dieses Benutzers:</label> <input type="text" name="description" id="description" /></p>
79) <h4>Passwort</h4>
|
Passwort-Erzeugung auch bei...
Bernd Wurst authored 11 years ago
|
80) <p><input onchange="document.getElementById(\'newpass_display\').parentNode.style.display=\'none\'" type="password" name="newpass" id="newpass" value="" /> <button type="button" onclick="setRandomPassword()">Passwort erzeugen</button></p>
|