merged patch #462787 (Home page for unpriviliged user) thanks to Piotr Roszatycki

This commit is contained in:
Loïc Chapeaux
2001-09-19 17:58:08 +00:00
parent e4ea15b692
commit 7173343878

View File

@@ -171,11 +171,13 @@ if ($server > 0
} }
// Does user have global Create priv? // Does user have global Create priv?
$local_query = 'SELECT * FROM mysql.user WHERE User = \'' . sql_addslashes($cfgServer['user']) . '\''; $local_query = 'SELECT * FROM mysql.user WHERE User = \'' . sql_addslashes($cfgServer['user']) . '\'';
$rs_usr = mysql_query($local_query, $stdlink) or mysql_die('', $local_query, FALSE); $rs_usr = mysql_query($local_query, $stdlink) or mysql_die('', $local_query, FALSE);
$result_usr = mysql_fetch_array($rs_usr); if ($rs_usr) {
$create = ($result_usr['Create_priv'] == 'Y'); $result_usr = mysql_fetch_array($rs_usr);
$db_to_create = ''; $create = ($result_usr['Create_priv'] == 'Y');
$db_to_create = '';
}
// Does user have Create priv on a inexistant db? // Does user have Create priv on a inexistant db?
// if yes, show him in the dialog the first inexistant db name that we // if yes, show him in the dialog the first inexistant db name that we
@@ -196,16 +198,19 @@ if ($server > 0
} }
$local_query = 'SELECT Db FROM mysql.db WHERE User = \'' . sql_addslashes($cfgServer['user']) . '\''; $local_query = 'SELECT Db FROM mysql.db WHERE User = \'' . sql_addslashes($cfgServer['user']) . '\'';
$rs_usr = mysql_query($local_query, $stdlink) or mysql_die('', $local_query, FALSE); $rs_usr = mysql_query($local_query, $stdlink);
while ($row = mysql_fetch_array($rs_usr)) { if ($rs_usr) {
if (!mysql_select_db($row['Db'], $userlink)) { while ($row = mysql_fetch_array($rs_usr)) {
$db_to_create = $row['Db']; if (!mysql_select_db($row['Db'], $userlink)) {
$create = TRUE; $db_to_create = $row['Db'];
break; $create = TRUE;
} break;
} } // end if
} // end while
} // end if
mysql_free_result($rs_usr); mysql_free_result($rs_usr);
} } // end if
// The user is allowed to create a db // The user is allowed to create a db
if ($create) { if ($create) {
echo "\n"; echo "\n";