Example #1
0
 public function MasterAdd($id, $name, $description, $password)
 {
     $random_salt = \Lobby::randStr(15);
     $hashed = hash("sha512", $this->master_salt . $password . $random_salt);
     if (!$this->MasterExists($id)) {
         saveData("master_" . $id . "_name", $name);
         saveData("master_" . $id . "_description", $description);
         saveData("master_" . $id . "_password", $hashed);
         saveData("master_" . $id . "_password_salt", $random_salt);
         saveData("master_" . $id . "_items", '');
         \H::saveJSONData("keyrings", array($id => 1));
         return true;
     } else {
         return false;
     }
 }
Example #2
0
<?php

if (getOption("admin_installed") == null && \Lobby::$installed) {
    /**
     * Install Module
     */
    $salt = \Lobby::randStr(15);
    $cookie = \Lobby::randStr(15);
    saveOption("admin_secure_salt", $salt);
    saveOption("admin_secure_cookie", $cookie);
    $prefix = \Lobby\DB::$prefix;
    /**
     * Create `users` TABLE
     */
    $sql = \Lobby\DB::$dbh->prepare("CREATE TABLE IF NOT EXISTS `{$prefix}users` (\n\t  `id` int(11) NOT NULL AUTO_INCREMENT,\n\t  `username` varchar(10) NOT NULL,\n\t  `email` tinytext NOT NULL,\n\t  `password` varchar(64) NOT NULL,\n\t  `password_salt` varchar(20) NOT NULL,\n\t  `name` varchar(30) NOT NULL,\n\t  `created` datetime NOT NULL,\n\t  `attempt` varchar(15) NOT NULL DEFAULT '0',\n\t  PRIMARY KEY (`id`)\n  ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;");
    if ($sql->execute() != 0) {
        saveOption("admin_installed", "true");
    }
}
Example #3
0
<?php

$backupFile = \Lobby::$config['db']['dbname'] . "-" . date("Y-m-d-H-i-s") . "-" . \Lobby::randStr(10) . '.gz';
$backupFileLoc = L_DIR . "/contents/extra/" . $backupFile;
$command = "mysqldump --opt --host=" . $this->dbinfo['db_host'] . " --port=" . $this->dbinfo['db_port'] . " --user="******" --password="******" " . $this->dbinfo['db_name'] . " " . $this->dbinfo['db_table'] . " | gzip -9 -c > {$backupFileLoc}";
system($command);
sleep(5);
if (file_exists($backupFileLoc)) {
    echo \Lobby::l("/contents/extra/{$backupFile}", "Download SQL File", "class='button red' target='_blank'");
} else {
    echo "It didn't work. Try using phpMyAdmin to export Database. or direclty use the terminal command : <blockquote>{$command}</blockquote>";
}