本文整理汇总了PHP中Token::set方法的典型用法代码示例。如果您正苦于以下问题:PHP Token::set方法的具体用法?PHP Token::set怎么用?PHP Token::set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Token
的用法示例。
在下文中一共展示了Token::set方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createToken
public function createToken()
{
$hash = sha1(microtime() . mt_rand() . "salty bastard");
$token = new Token();
$token->set('user_id', $this->id);
$token->set('hash', $hash);
$token->set('expire_date', date("Y-m-d H:i:s", strtotime("+1 year")));
$token->save();
return $token;
}
示例2:
data-ad-client="ca-pub-8066383283274201"
data-ad-slot="3710749975"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
<div class="chat_wrap">
<div class="toggle">
<h3>Chat</h3>
</div>
<div class="chat">
<header>
<h3 class="toggle">Chat</h3>
</header>
<div class="chatArea">
<ul>
<li><em>Loading...</em></li>
</ul>
</div>
<form method="post">
<input type="text" name="chat_name" id="chat_name" maxlength="15" placeholder="Name" required>
<input type="text" name="chat_message" id="chat_message" maxlength="140" placeholder="Message" required autocomplete="off">
<input type="hidden" name="chat_token" id="chat_token" value="<?php
echo $token->set();
?>
">
</form>
</div>
</div>
<script src="http://www.adam-bray.com/includes/script.js"></script>
</body>
</html>
示例3: loginUser
function loginUser()
{
$data = Functions::getJSONData();
$nickname = Functions::elt($data, 'nickname');
$password = Functions::elt($data, 'password');
$expiration = Functions::elt($data, 'expiration');
$actionCount = Functions::elt($data, 'actionCount');
if (is_null($nickname) || is_null($password) || is_null($expiration) || is_null($actionCount)) {
Functions::setResponse(400);
}
$whereClause = 'nickname = :nickname';
$params = array(array('id' => ':nickname', 'value' => $nickname));
$custList = Customer::search($whereClause, $params);
if (!count($custList)) {
Functions::setResponse(403);
}
$customer = $custList[0];
if (Functions::hash($password) == $customer->get('password')) {
$t = new Token();
$t->set('customerId', $customer->get('id'));
$t->set('value', Functions::randomHash());
$t->set('expiration', time() + floor($expiration / 1000));
$t->set('actionCount', $actionCount);
$t->save();
return $t;
} else {
Functions::setResponse(403);
}
}
示例4: checkToken
public function checkToken($champ, $addrMail)
{
$retour = true;
$arch = new Archiviste();
$token = new Token();
$token->set($champ, $addrMail);
$tokens = $arch->restituer($token);
if (count($tokens) == 0) {
$retour = false;
} else {
$retour = $tokens[0];
}
return $retour;
}