function add_admin($pass) { global $gbl, $sgbl, $login, $ghtml; $client = new Client(null, null, 'admin'); $login = $client; $client->initThisDef(); $client->priv->pserver_num = 'Unlimited'; $client->priv->maindomain_num = 'Unlimited'; $client->priv->vps_num = 'Unlimited'; $client->priv->client_num = 'Unlimited'; $client->ddate = time(); $ddb = new Sqlite(null, "client"); if (!$ddb->existInTable("nname", 'admin')) { if ($sgbl->dbg > 0) { $pass = '******'; $res['contacemail'] = '*****@*****.**'; } $res['password'] = crypt($pass); $res['cttype'] = 'admin'; $res['cpstatus'] = 'on'; if (if_demo()) { $res['email'] = "*****@*****.**"; } $client->create($res); $client->driverApp = new client__sync(null, null, 'admin'); $client->was(); lxfile_mkdir("__path_client_root/{$client->nname}"); lxfile_generic_chown("__path_client_root/{$client->nname}", "lxlabs"); } $notif = new Notification(null, null, $client->getClName()); $notif->initThisDef(); $notif->dbaction = 'add'; $notif->text_newaccountmessage = lfile_get_contents("__path_program_root/file/welcome.txt"); $notif->parent_clname = $client->getClName(); $notif->write(); $display = new sp_SpecialPlay(null, null, $client->getClName()); $display->initThisDef(); $display->parent_clname = $client->getClName(); $display->dbaction = 'add'; $display->write(); }
function add_slave($pass) { global $gbl, $sgbl, $login, $ghtml; $client = new Slave(null, null, 'slave'); $client->initThisDef(); $ddb = new Sqlite(null, "slave"); if (!$ddb->existInTable("nname", 'slave')) { $res['password'] = $pass; $res['cttype'] = 'slave'; if (if_demo()) { $res['email'] = "*****@*****.**"; } $client->create($res); $client->write(); } }
function exists_in_db($server, $class, $nname) { $db = new Sqlite($server, get_table_from_class($class)); return $db->existInTable('nname', $nname); }