Changeset 1707

Show
Ignore:
Timestamp:
07/05/06 11:54:39 (2 years ago)
Author:
anarcat
Message:

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

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • alternc/trunk/bureau/class/m_mysql.php

    r1656 r1707  
    152152      $pa=addslashes($db->f("pass")); 
    153153    } 
    154     // Ok, database does not exist, quota is ok and dbname is compliant. Let's proceed 
    155     $db->query("INSERT INTO db (uid,login,pass,db,bck_mode) VALUES ('$cuid','$lo','$pa','$dbname',0);"); 
    156     // give everything but GRANT on db.* 
    157     // we assume there's already a user 
    158     $db->query("GRANT ALL PRIVILEGES ON `".$dbname."`.* TO '".$lo."'@'$this->client'"); 
    159     $db->query("CREATE DATABASE `$dbname`;"); 
    160     return true; 
     154    if ($db->query("CREATE DATABASE $dbname;")) { 
     155      // Ok, database does not exist, quota is ok and dbname is compliant. Let's proceed 
     156      $db->query("INSERT INTO db (uid,login,pass,db,bck_mode) VALUES ('$cuid','$lo','$pa','$dbname',0);"); 
     157      // give everything but GRANT on db.* 
     158      // we assume there's already a user 
     159      $db->query("GRANT ALL PRIVILEGES ON `".$dbname."`.* TO '".$lo."'@'$this->client'"); 
     160      return true; 
     161    } else { 
     162      $err->raise("mysql",3); 
     163      return false; 
     164    } 
    161165  } 
    162166