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


PHP Password::tokenExists方法代码示例

本文整理汇总了PHP中Password::tokenExists方法的典型用法代码示例。如果您正苦于以下问题:PHP Password::tokenExists方法的具体用法?PHP Password::tokenExists怎么用?PHP Password::tokenExists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Password的用法示例。


在下文中一共展示了Password::tokenExists方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: token

function token()
{
    global $instDir, $objMessages, $entryMessage;
    // Get the userid
    include_once $instDir . "lib/password.php";
    $password = new Password();
    $token = $_GET['t'];
    if ($password->tokenExists($token)) {
        // Only go on when the token is not too old. If the token is too old, remove the token.
        if ($password->isValid($token)) {
            // Go to the correct
            echo "<div id=\"main\">";
            // TODO: Add form to change the password.
            // TODO: Add scripts to change the password.
            print "TEST: " . $userid;
            echo "</div>";
        } else {
            // TODO: Change
            print "<br/>TOKEN IS NOT VALID ANYMORE!";
        }
    } else {
        // TODO: Change message
        $entryMessage = "TOKEN DOES NOT EXIST!";
        $_GET['indexAction'] = 'main';
        // TODO: Return the index page
        return;
    }
    if (sizeof($userid) > 0) {
        // Clear the request
        $password->removeToken($token);
        // Send a mail that the request was canceled.
        if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
            $ip = $_SERVER['HTTP_CLIENT_IP'];
        } elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
            $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
        } else {
            $ip = $_SERVER['REMOTE_ADDR'];
        }
        $subject = LangCancelRequestNewPasswordSubject;
        $message = LangCancelRequestNewPassword1 . $ip;
        $message .= LangCancelRequestNewPassword2;
        $objMessages->sendEmail($subject, $message, $userid);
        // Go to the DeepskyLog page and show 'Your password change request was canceled'
        $entryMessage = LangCancelRequestNewPasswordSubject . ".";
    }
}
开发者ID:rolfvandervleuten,项目名称:DeepskyLog,代码行数:46,代码来源:changeToken.php

示例2: change_password

function change_password()
{
    global $instDir, $entryMessage, $baseURL;
    include_once $instDir . "lib/password.php";
    $password = new Password();
    $token = $_GET['t'];
    // Move this to control, only setting the password to this file.
    // Only show the change password form when the token is known
    if ($password->tokenExists($token)) {
        $userid = $password->getUserId($token);
        // Check if the token is not too old. If the token is too old, remove the token.
        if ($password->isValid($token)) {
            // Add form to change the password.
            echo "<div id=\"main\">\n              <form action=\"" . $baseURL . "index.php?indexAction=changepasswordToken\" method=\"post\">\n              " . LangNewPassword . "\n              <input type=\"hidden\" name=\"userid\" value=\"" . $userid . "\" />\n              <input type=\"hidden\" name=\"token\" value=\"" . $token . "\" />\n              <input type=\"password\" name=\"newPassword\" class=\"strength\" required>" . LangChangeAccountField6 . "\n              <input type=\"password\" name=\"confirmPassword\" class=\"strength\" required data-show-meter=\"false\">\n              <br />\n              <input class=\"btn btn-danger\" type=\"submit\" name=\"changePasswordToken\" value=\"" . LangChangePassword . "\" />";
            echo "</div>";
        } else {
            echo "<meta http-equiv=\"refresh\" content=\"0; url=/index.php\" />";
        }
    } else {
        echo "<meta http-equiv=\"refresh\" content=\"0; url=/index.php\" />";
    }
}
开发者ID:rolfvandervleuten,项目名称:DeepskyLog,代码行数:22,代码来源:change_password.php


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