当前位置: 首页>>代码示例>>PHP>>正文


PHP generateSessionToken函数代码示例

本文整理汇总了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();
开发者ID:cinno,项目名称:DVWA,代码行数:30,代码来源:high.php

示例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);
}
开发者ID:peterleezz,项目名称:test,代码行数:8,代码来源:function.php


注:本文中的generateSessionToken函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。