Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 26 lines (23 sloc) 1.294 kb
5ce4d14 Prepare Privileges
jakubvrana authored
1 <?php
ec09c36 User privileges
jakubvrana authored
2 page_header(lang('Privileges'));
36d6864 Whitespace
jakubvrana authored
3
e854a04 Jakub Vrána Save bytes
authored
4 $result = $connection->query("SELECT User, Host FROM mysql." . (DB == "" ? "user" : "db WHERE " . q(DB) . " LIKE Db") . " ORDER BY Host, User");
2830ecd Jakub Vrána Edit existing user with db
authored
5 $grant = $result;
ec09c36 User privileges
jakubvrana authored
6 if (!$result) {
409f968 Create user on the same domain by default
jakubvrana authored
7 // list logged user, information_schema.USER_PRIVILEGES lists just the current user too
64d616c Rename get_dbh to connection
jakubvrana authored
8 $result = $connection->query("SELECT SUBSTRING_INDEX(CURRENT_USER, '@', 1) AS User, SUBSTRING_INDEX(CURRENT_USER, '@', -1) AS Host");
5ce4d14 Prepare Privileges
jakubvrana authored
9 }
2830ecd Jakub Vrána Edit existing user with db
authored
10 echo "<form action=''><p>\n";
11 hidden_fields_get();
12 echo "<input type='hidden' name='db' value='" . h(DB) . "'>\n";
13 echo ($grant ? "" : "<input type='hidden' name='grant' value=''>\n");
d30face Remove useless table attributes (thanks to Juraj Krivda)
jakubvrana authored
14 echo "<table cellspacing='0'>\n";
2830ecd Jakub Vrána Edit existing user with db
authored
15 echo "<thead><tr><th>" . lang('Username') . "<th>" . lang('Server') . "<th>&nbsp;</thead>\n";
ec09c36 User privileges
jakubvrana authored
16 while ($row = $result->fetch_assoc()) {
2830ecd Jakub Vrána Edit existing user with db
authored
17 echo '<tr' . odd() . '><td>' . h($row["User"]) . "<td>" . h($row["Host"]) . '<td><a href="' . h(ME . 'user=' . urlencode($row["User"]) . '&host=' . urlencode($row["Host"])) . '">' . lang('Edit') . "</a>\n";
18 }
19 if (!$grant || DB != "") {
20 echo "<tr" . odd() . "><td><input name='user'><td><input name='host' value='localhost'><td><input type='submit' value='" . lang('Edit') . "'>\n";
ec09c36 User privileges
jakubvrana authored
21 }
22 echo "</table>\n";
2830ecd Jakub Vrána Edit existing user with db
authored
23 echo "</form>\n";
61bda35 Action after listing
jakubvrana authored
24
25 echo '<p><a href="' . h(ME) . 'user=">' . lang('Create user') . "</a>";
Something went wrong with that request. Please try again.