本文整理汇总了PHP中tools::generateRandomString方法的典型用法代码示例。如果您正苦于以下问题:PHP tools::generateRandomString方法的具体用法?PHP tools::generateRandomString怎么用?PHP tools::generateRandomString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tools
的用法示例。
在下文中一共展示了tools::generateRandomString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($socket, $index, $address)
{
// set private variables
$this->socket = $socket;
$this->index = $index;
$this->ip = $address['ip'];
$this->port = $address['port'];
// create challenge
$this->challenge = tools::generateRandomString(10);
// create session
$this->session = tools::generateRandomInt(5);
// send challenge to client
$response = gamespy::xor_this('\\lc\\1\\challenge\\' . $this->challenge . '\\id\\1') . '\\final\\';
tools::log('server: ' . '\\lc\\1\\challenge\\' . $this->challenge . '\\id\\1' . '\\final\\');
socket_write($this->socket, $response);
tools::log('initializing new client (' . $this->ip . ':' . $this->port . ')');
}
示例2: gs_getprofile
/**
*
* @param type $ex
* @return boolean
*/
public function gs_getprofile($ex)
{
if (isset($ex[array_search('sesskey', $ex) + 1]) and isset($ex[array_search('profileid', $ex) + 1])) {
$profileID = $ex[array_search('profileid', $ex) + 1];
$id = $ex[array_search('id', $ex) + 1];
$query = "SELECT * FROM users WHERE id='" . intval($profileID) . "' LIMIT 0,1";
$sql = database::query($query);
if (database::num_rows($sql) == 1) {
$row = database::fetch_object($sql);
$response = '\\pi\\' . '\\profileid\\' . $profileID . '\\nick\\' . $row->name . '\\userid\\' . $profileID . '\\email\\' . $row->email . '\\sig\\' . tools::generateRandomString(32) . '\\uniquenick\\' . $row->name . '\\pid\\0' . '\\firstname\\' . '\\lastname\\' . '\\countrycode\\US' . '\\birthday\\16844722' . '\\lon\\0.000000' . '\\lat\\0.000000' . '\\loc\\' . '\\id\\' . $id . '\\final\\';
tools::log("server: " . $response);
socket_write($this->socket, $response);
} else {
return false;
}
}
return true;
}