ne pas donner les permissions sur les bases deja existante. reste a tester. see #698

This commit is contained in:
Antoine Beaupré 2006-07-05 09:54:39 +00:00
parent 4428255110
commit d288a2f1c0
1 changed files with 11 additions and 7 deletions

View File

@ -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;
}
}
/*---------------------------------------------------------------------------*/