Ejemplo n.º 1
0
 /** 激活邮箱 **/
 public function confirm_email()
 {
     $token = I("get.token");
     if (empty($token)) {
         $title = '激活失败';
         $tip = '激活链接地址参数有误!';
     } else {
         $userInfo = S($token);
         if (empty($userInfo)) {
             $title = '激活失败';
             $tip = '激活链接地址已经过期';
             $is_ok = 'no';
         } else {
             //验证用户
             $user_email = $userInfo['email'];
             $uid = $userInfo['uid'];
             $mail = get_email($uid);
             if ($mail != $user_email) {
                 $title = '激活失败';
                 $tip = '激活链接地址参数有误!';
                 $is_ok = 'no';
             } else {
                 $userModel = new UserApi();
                 $userModel->updateUserStatus($uid, 1);
                 $title = '激活成功';
                 $tip = '已激活成功';
                 $is_ok = 'yes';
                 //清空本次的缓存key
                 S($token, null);
                 $this->assign('email', $mail);
             }
         }
     }
     $this->assign('tip', $tip);
     $this->assign('is_ok', $is_ok);
     $this->assign('title', $title);
     $this->display('User/confirm_email');
 }