本文整理汇总了PHP中generateSessionToken函数的典型用法代码示例。如果您正苦于以下问题:PHP generateSessionToken函数的具体用法?PHP generateSessionToken怎么用?PHP generateSessionToken使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了generateSessionToken函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: recaptcha_check_answer
$pass_new = $_POST['password_new'];
$pass_conf = $_POST['password_conf'];
// Check CAPTCHA from 3rd party
$resp = recaptcha_check_answer($_DVWA['recaptcha_private_key'], $_SERVER['REMOTE_ADDR'], $_POST['recaptcha_challenge_field'], $_POST['recaptcha_response_field']);
// Did the CAPTCHA fail?
if (!$resp->is_valid && ($_POST['recaptcha_response_field'] != 'hidd3n_valu3' || $_SERVER['HTTP_USER_AGENT'] != 'reCAPTCHA')) {
// What happens when the CAPTCHA was entered incorrectly
$html .= "<pre><br />The CAPTCHA was incorrect. Please try again.</pre>";
$hide_form = false;
return;
} else {
// CAPTCHA was correct. Do both new passwords match?
if ($pass_new == $pass_conf) {
$pass_new = mysql_real_escape_string($pass_new);
$pass_new = md5($pass_new);
// Update database
$insert = "UPDATE `users` SET password = '{$pass_new}' WHERE user = '" . dvwaCurrentUser() . "' LIMIT 1;";
$result = mysql_query($insert) or die('<pre>' . mysql_error() . '</pre>');
// Feedback for user
$html .= "<pre>Password Changed.</pre>";
} else {
// Ops. Password mismatch
$html .= "<pre>Both passwords must match.</pre>";
$hide_form = false;
}
}
mysql_close();
}
// Generate Anti-CSRF token
generateSessionToken();
示例2: loginSession
function loginSession($user)
{
$auth = array('uid' => $user['id'], 'username' => $user['username'], 'last_login_time' => $user['last_login_time']);
// session('sys_user_auth', $auth);
// session('sys_user_auth_sign', data_auth_sign($auth));
$sid = generateSessionToken($user["id"]);
cookie("sid", $sid);
}