本文整理汇总了PHP中Lobby::randStr方法的典型用法代码示例。如果您正苦于以下问题:PHP Lobby::randStr方法的具体用法?PHP Lobby::randStr怎么用?PHP Lobby::randStr使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Lobby
的用法示例。
在下文中一共展示了Lobby::randStr方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: MasterAdd
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;
}
}
示例2: saveOption
<?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");
}
}
示例3: date
<?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=" . $this->dbinfo['db_username'] . " --password=" . $this->dbinfo['db_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>";
}