From d288a2f1c01a60523a353b7c7fa0c20e31ab5e63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antoine=20Beaupr=C3=A9?= Date: Wed, 5 Jul 2006 09:54:39 +0000 Subject: [PATCH] ne pas donner les permissions sur les bases deja existante. reste a tester. see #698 --- bureau/class/m_mysql.php | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/bureau/class/m_mysql.php b/bureau/class/m_mysql.php index d602f206..8c9393c6 100644 --- a/bureau/class/m_mysql.php +++ b/bureau/class/m_mysql.php @@ -151,13 +151,17 @@ class m_mysql { $lo=addslashes($db->f("login")); $pa=addslashes($db->f("pass")); } - // Ok, database does not exist, quota is ok and dbname is compliant. Let's proceed - $db->query("INSERT INTO db (uid,login,pass,db,bck_mode) VALUES ('$cuid','$lo','$pa','$dbname',0);"); - // give everything but GRANT on db.* - // we assume there's already a user - $db->query("GRANT ALL PRIVILEGES ON `".$dbname."`.* TO '".$lo."'@'$this->client'"); - $db->query("CREATE DATABASE `$dbname`;"); - return true; + if ($db->query("CREATE DATABASE $dbname;")) { + // Ok, database does not exist, quota is ok and dbname is compliant. Let's proceed + $db->query("INSERT INTO db (uid,login,pass,db,bck_mode) VALUES ('$cuid','$lo','$pa','$dbname',0);"); + // give everything but GRANT on db.* + // we assume there's already a user + $db->query("GRANT ALL PRIVILEGES ON `".$dbname."`.* TO '".$lo."'@'$this->client'"); + return true; + } else { + $err->raise("mysql",3); + return false; + } } /*---------------------------------------------------------------------------*/