• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP validateActivationToken函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中validateActivationToken函数的典型用法代码示例。如果您正苦于以下问题:PHP validateActivationToken函数的具体用法?PHP validateActivationToken怎么用?PHP validateActivationToken使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: generateActivationToken

function generateActivationToken($gen = null)
{
    do {
        $gen = md5(uniqid(mt_rand(), false));
    } while (validateActivationToken($gen));
    return $gen;
}
开发者ID:sangikumar,项目名称:IP,代码行数:7,代码来源:funcs.php


示例2: lang

                    $errors[] = lang("SQL_ERROR");
                } else {
                    if (!flagLostPasswordRequest($userdetails["user_name"], 0)) {
                        $errors[] = lang("SQL_ERROR");
                    } else {
                        $successes[] = lang("FORGOTPASS_NEW_PASS_EMAIL");
                    }
                }
            }
        }
    }
}
//User has denied this request
if (!empty($_GET["deny"])) {
    $token = trim($_GET["deny"]);
    if ($token == "" || !validateActivationToken($token, TRUE)) {
        $errors[] = lang("FORGOTPASS_INVALID_TOKEN");
    } else {
        $userdetails = fetchUserDetails(NULL, $token);
        if (!flagLostPasswordRequest($userdetails["user_name"], 0)) {
            $errors[] = lang("SQL_ERROR");
        } else {
            $successes[] = lang("FORGOTPASS_REQUEST_CANNED");
        }
    }
}
//Forms posted
if (!empty($_POST)) {
    $email = $_POST["email"];
    $username = sanitize($_POST["username"]);
    //Perform some validation
开发者ID:fEDUntu,项目名称:ladolcenoteca,代码行数:31,代码来源:forgot-password.php


示例3: lang

/*
UserCake Version: 2.0.1
http://usercake.com
*/
require_once "models/config.php";
if (!securePage($_SERVER['PHP_SELF'])) {
    die;
}
//Get token param
if (isset($_GET["token"])) {
    $token = $_GET["token"];
    if (!isset($token)) {
        $errors[] = lang("FORGOTPASS_INVALID_TOKEN");
    } else {
        if (!validateActivationToken($token)) {
            $errors[] = lang("ACCOUNT_TOKEN_NOT_FOUND");
        } else {
            //Activate the users account
            if (!setUserActive($token)) {
                $errors[] = lang("SQL_ERROR");
            }
        }
    }
} else {
    $errors[] = lang("FORGOTPASS_INVALID_TOKEN");
}
if (count($errors) == 0) {
    $successes[] = lang("ACCOUNT_ACTIVATION_COMPLETE");
}
require_once "models/header.php";
开发者ID:garnaudov,项目名称:webapp,代码行数:30,代码来源:activate-account.php


示例4: index

 public function index()
 {
     /*
     UserCake (Via CupCake) Version: 2.0.2
     http://usercake.com
     */
     global $baseURL;
     $baseURL = getcwd();
     require_once "{$baseURL}/application/third_party/user_cake/models/config.php";
     if (!securePage($_SERVER['PHP_SELF'])) {
         die;
     }
     //User has confirmed they want their password changed
     if (!empty($_GET["confirm"])) {
         $token = trim($_GET["confirm"]);
         if ($token == "" || !validateActivationToken($token, TRUE)) {
             $errors[] = lang("FORGOTPASS_INVALID_TOKEN");
         } else {
             $rand_pass = getUniqueCode(15);
             //Get unique code
             $secure_pass = generateHash($rand_pass);
             //Generate random hash
             $userdetails = fetchUserDetails(NULL, $token);
             //Fetchs user details
             $mail = new userCakeMail();
             //Setup our custom hooks
             $hooks = array("searchStrs" => array("#GENERATED-PASS#", "#USERNAME#"), "subjectStrs" => array($rand_pass, $userdetails["display_name"]));
             if (!$mail->newTemplateMsg("{$baseURL}/application/third_party/user_cake/mail-templates/your-lost-password.txt", $hooks)) {
                 $errors[] = lang("MAIL_TEMPLATE_BUILD_ERROR");
             } else {
                 if (!$mail->sendMail($userdetails["email"], "Your new password")) {
                     $errors[] = lang("MAIL_ERROR");
                 } else {
                     if (!updatePasswordFromToken($secure_pass, $token)) {
                         $errors[] = lang("SQL_ERROR");
                     } else {
                         if (!flagLostPasswordRequest($userdetails["user_name"], 0)) {
                             $errors[] = lang("SQL_ERROR");
                         } else {
                             $successes[] = lang("FORGOTPASS_NEW_PASS_EMAIL");
                         }
                     }
                 }
             }
         }
     }
     //User has denied this request
     if (!empty($_GET["deny"])) {
         $token = trim($_GET["deny"]);
         if ($token == "" || !validateActivationToken($token, TRUE)) {
             $errors[] = lang("FORGOTPASS_INVALID_TOKEN");
         } else {
             $userdetails = fetchUserDetails(NULL, $token);
             if (!flagLostPasswordRequest($userdetails["user_name"], 0)) {
                 $errors[] = lang("SQL_ERROR");
             } else {
                 $successes[] = lang("FORGOTPASS_REQUEST_CANNED");
             }
         }
     }
     //Forms posted
     if (!empty($_POST)) {
         $email = $_POST["email"];
         $username = sanitize($_POST["username"]);
         //Perform some validation
         //Feel free to edit / change as required
         if (trim($email) == "") {
             $errors[] = lang("ACCOUNT_SPECIFY_EMAIL");
         } else {
             if (!isValidEmail($email) || !emailExists($email)) {
                 $errors[] = lang("ACCOUNT_INVALID_EMAIL");
             }
         }
         if (trim($username) == "") {
             $errors[] = lang("ACCOUNT_SPECIFY_USERNAME");
         } else {
             if (!usernameExists($username)) {
                 $errors[] = lang("ACCOUNT_INVALID_USERNAME");
             }
         }
         if (count($errors) == 0) {
             //Check that the username / email are associated to the same account
             if (!emailUsernameLinked($email, $username)) {
                 $errors[] = lang("ACCOUNT_USER_OR_EMAIL_INVALID");
             } else {
                 //Check if the user has any outstanding lost password requests
                 $userdetails = fetchUserDetails($username);
                 if ($userdetails["lost_password_request"] == 1) {
                     $errors[] = lang("FORGOTPASS_REQUEST_EXISTS");
                 } else {
                     //Email the user asking to confirm this change password request
                     //We can use the template builder here
                     //We use the activation token again for the url key it gets regenerated everytime it's used.
                     $mail = new userCakeMail();
                     $confirm_url = lang("CONFIRM") . "\n" . $websiteUrl . "forgot-password.php?confirm=" . $userdetails["activation_token"];
                     $deny_url = lang("DENY") . "\n" . $websiteUrl . "forgot-password.php?deny=" . $userdetails["activation_token"];
                     //Setup our custom hooks
                     $hooks = array("searchStrs" => array("#CONFIRM-URL#", "#DENY-URL#", "#USERNAME#"), "subjectStrs" => array($confirm_url, $deny_url, $userdetails["user_name"]));
                     if (!$mail->newTemplateMsg("{$baseURL}/application/third_party/user_cake/mail-templates/lost-password-request.txt", $hooks)) {
                         $errors[] = lang("MAIL_TEMPLATE_BUILD_ERROR");
//.........这里部分代码省略.........
开发者ID:AdwayLele,项目名称:CupCake,代码行数:101,代码来源:forgot_password.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP validateAddition函数代码示例发布时间:2022-05-23
下一篇:
PHP validate函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap