【问题标题】:Activating account using Email Verification使用电子邮件验证激活帐户
【发布时间】:2017-06-22 11:57:43
【问题描述】:

出现错误。请通过错误 ####@admin.com 联系管理员 通过电子邮件激活确认您的帐户,请联系####@admin.com

一直在尝试通过电子邮件地址设置帐户验证,电子邮件已成功发送到用户地址,但是当用户单击发送到其帐户的链接时,出现上述错误。

来自电子邮件的链接

href="' . base_url() . 'register/validate_email/' . $email . '/' . $email_code . '"

当您点击电子邮件中的链接时,它会指向

注册控制器

public function validate_email($email_address, $email_code)
{
    $email_code=trim($email_code);
    $validated =  $this->model_user->validate_email($email_address,           $email_code);
    if($validated ==  true)
    {
        $this->load->view('includes/header');
        $this->load->view('registration/view_email_validated', array('s_email' => $email_address));
        $this->load->view('includes/footer');
    }
    else{
        echo 'Error confirming your account via email ativation, Please       contact '. $this->config->item('admin_email');
    }
}

Model_user

public function validate_email($email_address, $email_code)
{
     $sql = "select student_id, s_email, s_name from qcs_student where s_email = '{ $email_address }' limit 1";
    $result = $this->db->query($sql);
    $row = $result->row();
    if($result->num_rows() == 1 && $row->s_name)
    {
        if(md5((string)$row->student_id) == $email_code)
        {
            $result = $this->activate_account($email_address);
        }
        else
        {
            $result = false;
        }
        if($result = true)
        {
            return true;
        }
        else
        {
            echo 'Something is wrong, Please contact Administrator at '. $this->config->item('admin_email');
            return false;
        }
    }
    else
    {
        echo 'There was an error. Please contact Admin at '. $this->config->item('admin_email');
    }
}

【问题讨论】:

    标签: php codeigniter


    【解决方案1】:

    如下所示更新 $sql:(移除 email_address 的 {} 保护):

    $sql = "select student_id, s_email, s_name from qcs_student where s_email = '$email_address' limit 1";
    

    【讨论】:

      猜你喜欢
      • 2014-08-17
      • 1970-01-01
      • 2020-02-15
      • 1970-01-01
      • 2013-07-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-04-27
      相关资源
      最近更新 更多