Create user on the same domain by default

git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@750 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
jakubvrana 2009-06-22 06:11:15 +00:00
parent 97807b0f9f
commit 409f968295
3 changed files with 3 additions and 3 deletions

View file

@ -3,7 +3,6 @@ page_header(lang('Privileges'));
echo '<p><a href="' . htmlspecialchars($SELF) . 'user=">' . lang('Create user') . "</a></p>"; echo '<p><a href="' . htmlspecialchars($SELF) . 'user=">' . lang('Create user') . "</a></p>";
$result = $dbh->query("SELECT User, Host FROM mysql.user ORDER BY Host, User"); $result = $dbh->query("SELECT User, Host FROM mysql.user ORDER BY Host, User");
if (!$result) { if (!$result) {
//! utilize information_schema.USER_PRIVILEGES in MySQL 5
?> ?>
<form action=""><p> <form action=""><p>
<?php if (strlen($_GET["server"])) { ?><input type="hidden" name="server" value="<?php echo htmlspecialchars($_GET["server"]); ?>" /><?php } ?> <?php if (strlen($_GET["server"])) { ?><input type="hidden" name="server" value="<?php echo htmlspecialchars($_GET["server"]); ?>" /><?php } ?>
@ -13,7 +12,7 @@ if (!$result) {
<input type="submit" value="<?php echo lang('Edit'); ?>" /> <input type="submit" value="<?php echo lang('Edit'); ?>" />
</p></form> </p></form>
<?php <?php
// list logged user // list logged user, information_schema.USER_PRIVILEGES lists just the current user too
$result = $dbh->query("SELECT SUBSTRING_INDEX(CURRENT_USER, '@', 1) AS User, SUBSTRING_INDEX(CURRENT_USER, '@', -1) AS Host"); $result = $dbh->query("SELECT SUBSTRING_INDEX(CURRENT_USER, '@', 1) AS User, SUBSTRING_INDEX(CURRENT_USER, '@', -1) AS Host");
} }
echo "<table cellspacing='0'>\n"; echo "<table cellspacing='0'>\n";

View file

@ -113,7 +113,7 @@ if ($_POST) {
$row = $_POST; $row = $_POST;
$grants = $new_grants; $grants = $new_grants;
} else { } else {
$row = $_GET + array("host" => "localhost"); // create user on localhost by default $row = $_GET + array("host" => $dbh->result($dbh->query("SELECT SUBSTRING_INDEX(CURRENT_USER, '@', -1)"))); // create user on the same domain by default
$row["pass"] = $old_pass; $row["pass"] = $old_pass;
if (strlen($old_pass)) { if (strlen($old_pass)) {
$row["hashed"] = true; $row["hashed"] = true;

View file

@ -12,6 +12,7 @@ IE6 - <label for>
Edit default values directly in table creation Edit default values directly in table creation
Single column foreign key definition in table creation Single column foreign key definition in table creation
Offer enum items in search Offer enum items in search
Use event $intervals + microseconds in relative date functions
Ability to select external style - list downloaded by JavaScript Ability to select external style - list downloaded by JavaScript
? Column and table names auto-completition in SQL textarea ? Column and table names auto-completition in SQL textarea
? Save token also to cookie - for session expiration and login in other window ? Save token also to cookie - for session expiration and login in other window