From c1849a6ae089109103464e47935cf2253c9ed086 Mon Sep 17 00:00:00 2001 From: Marc Delisle Date: Fri, 6 Jul 2001 19:53:08 +0000 Subject: [PATCH] bug 438749 Database lockout --- ChangeLog | 4 ++++ main.php3 | 24 +++++++++++++++++++++--- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 06dfc5bcd..3b41e9c95 100755 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,10 @@ phpMyAdmin - Changelog $Id$ $Source$ +2001-07-06 Marc Delisle + * 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 [uid23515] * releasing 2.2.0rc1 and cleaned up old cvs tree diff --git a/main.php3 b/main.php3 index 016c68c6f..d72eb171a 100755 --- a/main.php3 +++ b/main.php3 @@ -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 */ require('./grab_globals.inc.php3'); @@ -126,10 +126,28 @@ if ($server > 0 } else { $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); $result_usr = mysql_fetch_array($rs_usr); $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 if ($create) { echo "\n"; @@ -141,7 +159,7 @@ if ($server > 0 - + @@ -213,7 +231,7 @@ if ($server > 0
  • -
    +