Php yii框架下的电子邮件验证

Php yii框架下的电子邮件验证,php,yii,email-verification,yii-url-manager,Php,Yii,Email Verification,Yii Url Manager,我想在用户单击随机生成的URL时对其进行验证 给我这两个过程的解决方案 1.从URL请求获取哈希(字符串和数字)的URL管理器配置规则是什么 2.如何将URL中的哈希值与控制器/操作上数据库中的哈希值进行比较 发送电子邮件的代码(工作正常) 控制器中的代码 public function actionActivate($activation) { $model= Signup::model()->findByAttributes(array( 'activate_link' =>

我想在用户单击随机生成的URL时对其进行验证

给我这两个过程的解决方案

1.从URL请求获取哈希(字符串和数字)的URL管理器配置规则是什么

2.如何将URL中的哈希值与控制器/操作上数据库中的哈希值进行比较

发送电子邮件的代码(工作正常)

控制器中的代码

public function actionActivate($activation) {
$model= Signup::model()->findByAttributes(array(
  'activate_link' => $activation
));
if ($model === null)
    $this->redirect('index.php');

else 
   $model->user_status = 1;
$model->save();
$this->redirect('index.php');
//redirect / flash / login whatever
}

和当前URLManager配置

'urlManager'=>array(
        'urlFormat'=>'path',
        'showScriptName'=>false,
        'rules'=>array(
            '<controller:\w+>/<id:\d+>' => '<controller>/view',
            '<controller:\w+>/<action:\w+>/<id:\d+>' => '<controller>/<action>',
            '<controller:\w+>/<action:\w+>' => '<controller>/<action>',

        ),
    ),
'urlManager'=>数组(
“urlFormat'=>“路径”,
'showScriptName'=>false,
'规则'=>数组(
“/”=>“/视图”,
'//' => '/',
'/' => '/',
),
),

在Url管理器中进行更改,如图所示

'urlManager'=>array(
//HK_DEVELOPER NR:CHANGED TO GET TO GET THE URL IN DESIRED FORMAT
    'urlFormat'=>'get',
    'rules'=>array(
        '<controller:\w+>/<id:\d+>'=>'<controller>/view',
        '<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
        '<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
    ),
),

你知道,在所有现代网站中,通过电子邮件验证新用户是一个常规过程。你是否编写了发送电子邮件的代码,或者你想要完整的解决方案?嗨,欢迎使用StackOverflow。这个网站不是一个人们“给你一个解决方案”的网站;您需要演示如何尝试解决某个特定问题,并遇到问题。你很可能因此得不到答案。请阅读。嗨,谢谢你的建议,现在我用代码更新了我的问题你面临什么问题?谢谢Ninad,感谢你的快速回答,让我试试Ninad,这是我的url结构,pat是关键,我必须用你的变量(关键)替换它
'urlManager'=>array(
//HK_DEVELOPER NR:CHANGED TO GET TO GET THE URL IN DESIRED FORMAT
    'urlFormat'=>'get',
    'rules'=>array(
        '<controller:\w+>/<id:\d+>'=>'<controller>/view',
        '<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
        '<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
    ),
),
public function actionConfirm(){
        //HK_DEVELOPER_NR:This action will confirm the user and change status from not authorize to authorized
        $passkey=$_GET['key'];
        $details=User::model()->findByAttributes(array('confirmationCode'=>$passkey));
        if(count($details)>=1)
        {
            if($details['userStatusId']==2){
                //CHECK IF AUTHORIZED REDIRECT TO PROFILE VIEW
                $url=Yii::app()->createUrl('site/login&joinbdp=false');
                $this->redirect($url);//USER CLICKS ON THE REGISTERATION LINK TWICE
            }else{
                $register=new Registerationconf;
                $value=$details['userId'];
                $register->userId=$value;
                $register->IPAddress=Yii::app()->request->userHostAddress;
                $register->confirmationTime=new CDbExpression('NOW()');
                $register->save();
                //CHANGE STATUS FROM NOT AUTHORIZED TO AUTHORIZED
                $post=User::model()->updateAll(array('userStatusId'=>'2'), 'confirmationCode=:confirmationCode',array(':confirmationCode'=>$passkey));
                $this->render('sucess');
            }
        }else {
            //IF USER IS REMOVED AND TRIES TO ACTIVATE THE LINK AGAIN
            echo "Please use valid URL. ";
        }
    }