Exemple #1
0
//
$code = $_GET['code'];
$email = $_GET['email'];
$uid = $_GET['uid'];
//
$ur = new \Ss\User\UserInfo($uid);
if ($ur->GetEmail() == $email) {
    $rs = '1';
} else {
    $rs = '0';
}
if (!$rs) {
    $a['code'] = '0';
    $a['msg'] = "邮箱错误";
} else {
    $rst = new \Ss\User\ResetPwd($uid);
    $u = new \Ss\User\User($uid);
    if ($rst->IsCharOK($code, $uid)) {
        $NewPwd = md5(time() . $uid . $email);
        $mg->sendMessage($domain, array('from' => "no-reply@" . $mailgun_domain, 'to' => $email, 'subject' => $site_name . "您的新密码", 'text' => "您的新密码为:" . $NewPwd));
        $u->UpdatePWd($NewPwd);
        $rst->Del($code, $uid);
        $a['code'] = '1';
        $a['ok'] = '1';
        $a['msg'] = "新密码已经发送到您的邮箱";
    } else {
        $a['code'] = '0';
        $a['msg'] = "链接无效";
    }
}
echo json_encode($a);