[Phpmyadmin-devel] Create Database

Tom Sommer - dreamcoder.dk ts at dreamcoder.dk
Fri Jun 4 12:00:00 CEST 2004


Hey,

I'm having some problems with the "Create Database" form being shown on 
the front page, even if the user does not have permission to create a 
new database.


I traced the problem down to line 246 in main.php (r: 2.8.2.1):

  else if (ereg($re0 . '%|_', $show_grants_dbname) || 
!PMA_mysql_select_db($show_grants_dbname, $userlink) && @mysql_errno() 
!= 1044) {

Where it is the ereg($re0 . '%|_', $show_grants_dbname) parts that 
returns true (1).

Now, I don't really know what this ereg() does, except for this part:
$re0 = '(^|(\\\\\\\\)+|[^\])';
Which I am sorry to say I don't understand.

So, I'm willing to fix the problem on my own (and submit a patch), if I 
could just get past this point. The problem is that my GRANT line looks 
like this:

GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, CREATE 
TEMPORARY TABLES, LOCK TABLES ON `domain_net_db`.* TO 'domain_net'@'%'

Which makes $show_grants_dbname contain `domain_net_db` and makes the 
ereg() return 1.

So in other words, what does the ereg do?

Thanks for any help

-- 
Tom Sommer




More information about the Developers mailing list