function createDefaultDatabase() { $dbname = fix_nname_to_be_variable($this->nname); $dbname = substr($dbname, 0, 15); $mysql = new Mysqldb(null, null, $dbname); $rl['primarydb'] = 'on'; $rl['dbname'] = $dbname; $rl['dbpassword'] = $this->realpass; $rl['username'] = $dbname; $rl['dbtype'] = 'mysql'; $rl['syncserver'] = $this->mysqldbsyncserver; $rl['parent_clname'] = $this->getClName(); $mysql->create($rl); $this->addToList('mysqldb', $mysql); return $mysql; }
<?php include_once "lib/include.php"; error_reporting(E_ALL); initProgram('admin'); $sq = new Sqlite(null, 'mysqldb'); $res = $sq->getTable(); if ($res) { foreach ($res as $r) { $db = new Mysqldb(null, $r['syncserver'], "aaa"); $db->dbtype = 'mysql'; $dbadmin = $db->getDbAdminPass(); mysql_connect($r['syncserver'], $dbadmin['dbadmin'], $dbadmin['dbpassword']); mysql_query("grant all on {$r['dbname']}.* to {$r['username']}@localhost"); mysql_query("grant all on {$r['dbname']}.* to {$r['username']}@'%'"); } }