bug 438749 Database lockout

This commit is contained in:
Marc Delisle
2001-07-06 19:53:08 +00:00
parent 046824c9ae
commit c1849a6ae0
2 changed files with 25 additions and 3 deletions

View File

@@ -5,6 +5,10 @@ phpMyAdmin - Changelog
$Id$ $Id$
$Source$ $Source$
2001-07-06 Marc Delisle <lem9@users.sourceforge.net>
* bug #438749 Database lockout: main.php3, we now show "Create
database" if user has Create priv on an inexistant db
2001-07-06 Olivier M<>ller <om@omnis.ch> [uid23515] 2001-07-06 Olivier M<>ller <om@omnis.ch> [uid23515]
* releasing 2.2.0rc1 and cleaned up old cvs tree * releasing 2.2.0rc1 and cleaned up old cvs tree

View File

@@ -4,7 +4,7 @@
/** /**
* Gets some core libraries and diplays a top message if required * Gets some core libraries and displays a top message if required
* TODO: The included script aren't yet xhtml1.0 compliant * TODO: The included script aren't yet xhtml1.0 compliant
*/ */
require('./grab_globals.inc.php3'); require('./grab_globals.inc.php3');
@@ -126,10 +126,28 @@ if ($server > 0
} else { } else {
$dbh = mysql_connect($cfgServer['host'] . ':' . $cfgServer['port'], $cfgServer['stduser'], $cfgServer['stdpass']); $dbh = 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'] . '"', $dbh);
$result_usr = mysql_fetch_array($rs_usr); $result_usr = mysql_fetch_array($rs_usr);
$create = ($result_usr['Create_priv'] == 'Y'); $create = ($result_usr['Create_priv'] == 'Y');
$db_to_create = "";
// Does user have Create priv on a inexistant db?
// if yes, show him in the dialog the first inexistant db name
// that we find, in most cases it's probably the one he just dropped :)
// (Note: we only get here after a browser reload, I don't know why)
if (!$create) {
$rs_usr = mysql_query('select Db from mysql.db where User="'
. $cfgServer['user'] . '"', $dbh);
while ($row = mysql_fetch_array($rs_usr)) {
if (!mysql_select_db($row['Db'])) {
$db_to_create = $row['Db'];
$create=true;
break;
}
}
}
// The user is allowed the create a db // The user is allowed the create a db
if ($create) { if ($create) {
echo "\n"; echo "\n";
@@ -141,7 +159,7 @@ if ($server > 0
<input type="hidden" name="server" value="<?php echo $server; ?>" /> <input type="hidden" name="server" value="<?php echo $server; ?>" />
<input type="hidden" name="lang" value="<?php echo $lang; ?>" /> <input type="hidden" name="lang" value="<?php echo $lang; ?>" />
<input type="hidden" name="reload" value="true" /> <input type="hidden" name="reload" value="true" />
<input type="text" name="db" /> <input type="text" name="db" value="<?php echo $db_to_create; ?>"/>
<input type="submit" value="<?php echo $strCreate; ?>" /> <input type="submit" value="<?php echo $strCreate; ?>" />
</form> </form>
</li> </li>