[Phpmyadmin-devel] database permission patch

Dan Allen bigredlinux at yahoo.com
Wed Aug 8 19:53:53 CEST 2001


I was using phpmyadmin with different user
account and discovered that while phpmyadmin
doesn't list the tables on the left frame for
restricted databases (which is good) when you
click on the database, it gives a confusing error
that no tables are found...which is not really
correct (also giving a mysql error output) it
should say that the user is restricted to use the
database...This might be more of an idea, but
here is a patch to correct this.  Build on it.

Dan Allen

--- phpMyAdmin2.2.0rc3/db_details.php	Sat Jul 21
22:02:58 2001
+++ phpMyAdmin/db_details.php	Tue Aug  7 23:59:11
2001
@@ -10,7 +10,20 @@
 } else {
     show_message($message);
 }
-
+/* We first need to check if we can actually do
anything with this database, because if not, no
point in 
+   showing any of the stuff on the page 
+   If you can't see the tables, then you can't
do anything, so here we go
+*/
+$query = "show open tables from $db";
+$result = mysql_query($query);
+if($result == "") {
+  if($AUTH) 
+    $denied_user = $cfgServer['stduser'];
+  else
+    $denied_user = $cfgServer['user'];
+  echo "The user <span style=\"font-weight:
bold;\">$denied_user</span> does not have the
proper permissions to access this database.";
+}
+else {
 /**
  * Displays an html table with all the tables
contained into the current
  * database
@@ -464,6 +477,7 @@
 
 
 <?php
+}  // End the if...else loop for permission to
access the database from all the way up top
 /**
  * Displays the footer
  */

__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/




More information about the Developers mailing list