2007-08-08 16:26:30 +00:00
|
|
|
<?php
|
2007-08-09 15:03:39 +00:00
|
|
|
page_header(lang('Privileges'));
|
2009-07-30 08:12:54 +00:00
|
|
|
echo '<p><a href="' . h(ME) . 'user=">' . lang('Create user') . "</a>";
|
2009-07-20 12:12:55 +00:00
|
|
|
|
2009-05-08 05:23:03 +00:00
|
|
|
$result = $dbh->query("SELECT User, Host FROM mysql.user ORDER BY Host, User");
|
2007-08-09 15:03:39 +00:00
|
|
|
if (!$result) {
|
2007-08-10 15:09:17 +00:00
|
|
|
?>
|
|
|
|
<form action=""><p>
|
2009-07-28 16:20:50 +00:00
|
|
|
<?php if (strlen($_GET["server"])) { ?><input type="hidden" name="server" value="<?php echo h($_GET["server"]); ?>"><?php } ?>
|
2009-07-11 20:30:40 +00:00
|
|
|
<?php echo lang('Username'); ?>: <input name="user">
|
|
|
|
<?php echo lang('Server'); ?>: <input name="host" value="localhost">
|
|
|
|
<input type="hidden" name="grant" value="">
|
|
|
|
<input type="submit" value="<?php echo lang('Edit'); ?>">
|
|
|
|
</form>
|
2007-08-10 15:09:17 +00:00
|
|
|
<?php
|
2009-06-22 06:11:15 +00:00
|
|
|
// list logged user, information_schema.USER_PRIVILEGES lists just the current user too
|
2009-05-08 05:23:03 +00:00
|
|
|
$result = $dbh->query("SELECT SUBSTRING_INDEX(CURRENT_USER, '@', 1) AS User, SUBSTRING_INDEX(CURRENT_USER, '@', -1) AS Host");
|
2007-08-08 16:26:30 +00:00
|
|
|
}
|
2009-05-01 10:41:33 +00:00
|
|
|
echo "<table cellspacing='0'>\n";
|
2009-07-11 20:30:40 +00:00
|
|
|
echo "<thead><tr><th> <th>" . lang('Username') . "<th>" . lang('Server') . "</thead>\n";
|
2007-08-09 15:03:39 +00:00
|
|
|
while ($row = $result->fetch_assoc()) {
|
2009-07-30 08:12:54 +00:00
|
|
|
echo '<tr' . odd() . '><td><a href="' . h(ME . 'user=' . urlencode($row["User"]) . '&host=' . urlencode($row["Host"])) . '">' . lang('edit') . '</a><td>' . h($row["User"]) . "<td>" . h($row["Host"]) . "\n";
|
2007-08-09 15:03:39 +00:00
|
|
|
}
|
|
|
|
echo "</table>\n";
|
|
|
|
$result->free();
|