bug 443710
This commit is contained in:
@@ -8,6 +8,8 @@ $Source$
|
||||
2001-07-24 Marc Delisle <lem9@users.sourceforge.net>
|
||||
* updates to french
|
||||
* new slovak translation thanks to lubos klokner <erkac@vault-tec.sk>
|
||||
* main.php3: bug 443710 Create New Database option: was working
|
||||
only if stduser has Global privileges on all databases.
|
||||
|
||||
2001-07-24 Steve ALberty <alberty@neptunlabs.de>
|
||||
* tbl_copy.php3: fix parameter count, thanks Marc
|
||||
|
20
main.php3
20
main.php3
@@ -116,17 +116,17 @@ if ($server == 0 || count($cfgServers) > 1) {
|
||||
if ($server > 0
|
||||
&& empty($cfgServer['only_db']))
|
||||
{
|
||||
// 2.1. With authentification
|
||||
// 2.1. With authentication
|
||||
if ($cfgServer['adv_auth'])
|
||||
{
|
||||
// Get user's rights
|
||||
if (empty($cfgServer['port'])) {
|
||||
$dbh = mysql_connect($cfgServer['host'], $cfgServer['stduser'], $cfgServer['stdpass']);
|
||||
$stdlink = mysql_connect($cfgServer['host'], $cfgServer['stduser'], $cfgServer['stdpass']);
|
||||
} else {
|
||||
$dbh = mysql_connect($cfgServer['host'] . ':' . $cfgServer['port'], $cfgServer['stduser'], $cfgServer['stdpass']);
|
||||
$stdlink = mysql_connect($cfgServer['host'] . ':' . $cfgServer['port'], $cfgServer['stduser'], $cfgServer['stdpass']);
|
||||
}
|
||||
// Does user have global Create priv?
|
||||
$rs_usr = mysql_query('select * from mysql.user where User="' . $cfgServer['user'] . '"', $dbh);
|
||||
$rs_usr = mysql_query('select * from mysql.user where User="' . $cfgServer['user'] . '"', $stdlink);
|
||||
$result_usr = mysql_fetch_array($rs_usr);
|
||||
$create = ($result_usr['Create_priv'] == 'Y');
|
||||
$db_to_create = "";
|
||||
@@ -137,10 +137,18 @@ if ($server > 0
|
||||
// (Note: we only get here after a browser reload, I don't know why)
|
||||
|
||||
if (!$create) {
|
||||
|
||||
if (empty($cfgServer['port'])) {
|
||||
$userlink = mysql_connect($cfgServer['host'], $cfgServer['user'], $cfgServer['password']) or mysql_die();
|
||||
} else {
|
||||
$userlink = mysql_connect($cfgServer['host'].":".
|
||||
$cfgServer['port'], $cfgServer['user'],
|
||||
$cfgServer['password']) or mysql_die();
|
||||
}
|
||||
$rs_usr = mysql_query('select Db from mysql.db where User="'
|
||||
. $cfgServer['user'] . '"', $dbh);
|
||||
. $cfgServer['user'] . '"', $stdlink);
|
||||
while ($row = mysql_fetch_array($rs_usr)) {
|
||||
if (!mysql_select_db($row['Db'])) {
|
||||
if (!mysql_select_db($row['Db'],$userlink)) {
|
||||
$db_to_create = $row['Db'];
|
||||
$create=true;
|
||||
break;
|
||||
|
Reference in New Issue
Block a user