忘记密码 - 在本地验证(codeigniter)

时间:2015-08-10 07:17:50

标签: php codeigniter anchor forgot-password

我在本地忘记了密码。所以我不知道它是否正确。

我可以使用链接验证吗

    <a href='".base_url()."user/pass_confirmation/$encrypted_string/$email'>

我的控制器功能

    function email_check()
    {

       $email=$this->input->post('email');
       $data = array(
        'user_email' =>$email, 
        );
       $result = $this->UM->email_verify($data);
      if($result)
       {
       echo $result;
       $date   = date(Y-m-d);
       $string = $email."-".$date;
       $encrypted_string = md5($string);
       echo $encrypted_string;
       $res=$this->UM->insert_key($encrypted_string,$result);
       $this->email->from('admin@b-scripts.com');
       $this->email->to($this->input->post('email'));
       $this->email->subject('Confirmation to reset password');
       $message = "<p>This email has been sent as a request to reset our password</p></br>";
       $message .= "<p><a href='".base_url()."user/pass_confirmation/$encrypted_string/$email'>'>Click here </a>if you want to reset your password,
                    if not, then ignore</p>";
        $this->email->message($message);
        $this->email->send();
        redirect(base_url()."user/forgot_pass");
   }
   else 
   {
      redirect(base_url()."user/forgot_pass");
   }

}

请为此提供建议

1 个答案:

答案 0 :(得分:1)

<a href='".$_SERVER['server_name']."user/pass_confirmation/$encrypted_string/$email'>

使用服务器名称。