Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/297.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 忘记了CodeIgniter中生成代码的密码_Php_Codeigniter - Fatal编程技术网

Php 忘记了CodeIgniter中生成代码的密码

Php 忘记了CodeIgniter中生成代码的密码,php,codeigniter,Php,Codeigniter,我已经生成了随机代码,但无法使用数据库表中的密码进行更新 下面是我忘记密码的控制器代码: public function forgot(){ if($this->input->post('submit')) { $email = $this->input->post('email'); $qry['email'] = $this->Employer_model->select($email); $emai

我已经生成了随机代码,但无法使用数据库表中的密码进行更新

下面是我忘记密码的控制器代码:

public function forgot(){
    if($this->input->post('submit')) {
        $email = $this->input->post('email');
        $qry['email'] = $this->Employer_model->select($email);
        $email1 = $qry['email']->email;

        if($email1 == $email) {
            $code1 = rand();
            $code = md5($code1);
            $employer_id = $GLOBALS['employer_id'];
            $qry1 = $this->Employer_model->insertpwd($code, $employer_id);

            if($qry1) {
                echo "<script>alert(' your new password is $code1!')</script>";
            }
        }
    }

    $this->load->view('employer/forgot');
}
public函数(){
如果($this->input->post('submit')){
$email=$this->input->post('email');
$qry['email']=$this->Employer\u model->select($email);
$email1=$qry['email']->email;
如果($email1==$email){
$code1=rand();
$code=md5($code1);
$employer_id=$GLOBALS['employer_id'];
$qry1=$this->Employer\u model->insertpwd($code,$Employer\u id);
若有($qry1){
回显“警报('您的新密码是$code1!')”;
}
}
}
$this->load->view('雇主/遗忘');
}
此模型用于从数据库表中选择电子邮件

public function sendpassword($data)
{
    $email = $data['email'];
    $query1=$this->db->query("SELECT *  from tablename where email = '".$email."' ");
    $row=$query1->result_array();
    if ($query1->num_rows()>0)
{
        $passwordplain = "";
        $passwordplain  = rand(999999999,9999999999);
        $newpass['password'] = md5($passwordplain);
        $this->db->where('email', $email);
        $this->db->update('employer_registration', $newpass);
        $mail_message='Dear '.$row[0]['name'].','. "\r\n";
        $mail_message.='Thanks for contacting regarding to forgot password,<br> Your <b>Password</b> is <b>'.$passwordplain.'</b>'."\r\n";
        $mail_message.='<br>Please Update your password.';
        $mail_message.='<br>Thanks & Regards';
        $mail_message.='<br>Your company name';
        require 'PHPMailerAutoload.php';
        require 'class.phpmailer.php';
        $mail = new PHPMailer;
        $mail->IsSendmail();
        $mail->isSMTP();
        $mail->SMTPAuth = true;
        $mail->Host = "hostname";
        $subject = 'Testing Email';
        $mail->AddAddress($email);
        $mail->IsMail();
        $mail->From = 'admin@***.com';
        $mail->FromName = 'admin';
        $mail->IsHTML(true);
        $mail->Subject = $subject;
        $mail->Body    = $mail_message;
        $mail->Send();
        if (!$mail->send()) {

            echo "<script>alert('msg','Failed to send password, please try again!')</script>";
        } else {

            echo "<script>alert('msg','Password sent to your email!')</script>";
        }
        redirect(base_url().'Jobseeker/index','refresh');
    }
    else
    {

        echo "<script>alert('msg','Email not found try again!')</script>";
        redirect(base_url().'Jobseeker/index','refresh');
    }
}
public函数sendpassword($data)
{
$email=$data['email'];
$query1=$this->db->query(“从表名中选择*其中email='”“$email.”);
$row=$query1->result_array();
如果($query1->num_rows()>0)
{
$passwordplain=“”;
$passwordplain=rand(99999999999999);
$newpass['password']=md5($passwordplain);
$this->db->where('email',$email);
$this->db->update(‘雇主注册’,$newpass);
$mail\U message='Dear'.$row[0]['name'].','。“\r\n”;
$mail\U message.='感谢您就忘记密码一事联系我们,
您的密码是'$passwordplain'。“\r\n”; $mail_message.='
请更新您的密码'; $mail_message.='
谢谢和问候'; $mail_message.='
您的公司名称'; 需要“PHPMailerAutoload.php”; 需要'class.phpmailer.php'; $mail=新的PHPMailer; $mail->IsSendmail(); $mail->isSMTP(); $mail->SMTPAuth=true; $mail->Host=“主机名”; $subject='测试电子邮件'; $mail->AddAddress($email); $mail->IsMail(); $mail->From='admin@***.com'; $mail->FromName='admin'; $mail->IsHTML(true); $mail->Subject=$Subject; $mail->Body=$mail\u message; $mail->Send(); 如果(!$mail->send()){ echo“警报('msg','发送密码失败,请重试!'”); }否则{ 回显“警报('msg','Password sent to your email!'”); } 重定向(base_url().“求职者/索引”,“刷新”); } 其他的 { 回显“警报('msg','Email not found try reat!”)”; 重定向(base_url().“求职者/索引”,“刷新”); } }
此模型用于创建随机密码和在注册电子邮件上发送电子邮件

此模型用于从数据库表中选择电子邮件

public function sendpassword($data)
{
    $email = $data['email'];
    $query1=$this->db->query("SELECT *  from tablename where email = '".$email."' ");
    $row=$query1->result_array();
    if ($query1->num_rows()>0)
{
        $passwordplain = "";
        $passwordplain  = rand(999999999,9999999999);
        $newpass['password'] = md5($passwordplain);
        $this->db->where('email', $email);
        $this->db->update('employer_registration', $newpass);
        $mail_message='Dear '.$row[0]['name'].','. "\r\n";
        $mail_message.='Thanks for contacting regarding to forgot password,<br> Your <b>Password</b> is <b>'.$passwordplain.'</b>'."\r\n";
        $mail_message.='<br>Please Update your password.';
        $mail_message.='<br>Thanks & Regards';
        $mail_message.='<br>Your company name';
        require 'PHPMailerAutoload.php';
        require 'class.phpmailer.php';
        $mail = new PHPMailer;
        $mail->IsSendmail();
        $mail->isSMTP();
        $mail->SMTPAuth = true;
        $mail->Host = "hostname";
        $subject = 'Testing Email';
        $mail->AddAddress($email);
        $mail->IsMail();
        $mail->From = 'admin@***.com';
        $mail->FromName = 'admin';
        $mail->IsHTML(true);
        $mail->Subject = $subject;
        $mail->Body    = $mail_message;
        $mail->Send();
        if (!$mail->send()) {

            echo "<script>alert('msg','Failed to send password, please try again!')</script>";
        } else {

            echo "<script>alert('msg','Password sent to your email!')</script>";
        }
        redirect(base_url().'Jobseeker/index','refresh');
    }
    else
    {

        echo "<script>alert('msg','Email not found try again!')</script>";
        redirect(base_url().'Jobseeker/index','refresh');
    }
}
public函数sendpassword($data)
{
$email=$data['email'];
$query1=$this->db->query(“从表名中选择*其中email='”“$email.”);
$row=$query1->result_array();
如果($query1->num_rows()>0)
{
$passwordplain=“”;
$passwordplain=rand(99999999999999);
$newpass['password']=md5($passwordplain);
$this->db->where('email',$email);
$this->db->update(‘雇主注册’,$newpass);
$mail\U message='Dear'.$row[0]['name'].','。“\r\n”;
$mail\U message.='感谢您就忘记密码一事联系我们,
您的密码是'$passwordplain'。“\r\n”; $mail_message.='
请更新您的密码'; $mail_message.='
谢谢和问候'; $mail_message.='
您的公司名称'; 需要“PHPMailerAutoload.php”; 需要'class.phpmailer.php'; $mail=新的PHPMailer; $mail->IsSendmail(); $mail->isSMTP(); $mail->SMTPAuth=true; $mail->Host=“主机名”; $subject='测试电子邮件'; $mail->AddAddress($email); $mail->IsMail(); $mail->From='admin@***.com'; $mail->FromName='admin'; $mail->IsHTML(true); $mail->Subject=$Subject; $mail->Body=$mail\u message; $mail->Send(); 如果(!$mail->send()){ echo“警报('msg','发送密码失败,请重试!'”); }否则{ 回显“警报('msg','Password sent to your email!'”); } 重定向(base_url().“求职者/索引”,“刷新”); } 其他的 { 回显“警报('msg','Email not found try reat!”)”; 重定向(base_url().“求职者/索引”,“刷新”); } }

此模型用于创建随机密码和在注册电子邮件上发送电子邮件

那么,问题在哪里?你的问题在哪里;你在寻找解决方案吗?我的问题是,我不能用旧密码更新新生成的代码。那么,问题在哪里?你的问题在哪里;你在寻找解决方案吗?我的问题是,我不能用旧密码更新新生成的代码。
 public function ForgotPassword($email)
{
    $this->db->select('email');
    $this->db->from('table');
    $this->db->where('email', $email);
    $query=$this->db->get();
    return $query->row_array();
}
public function sendpassword($data)
{
    $email = $data['email'];
    $query1=$this->db->query("SELECT *  from tablename where email = '".$email."' ");
    $row=$query1->result_array();
    if ($query1->num_rows()>0)
{
        $passwordplain = "";
        $passwordplain  = rand(999999999,9999999999);
        $newpass['password'] = md5($passwordplain);
        $this->db->where('email', $email);
        $this->db->update('employer_registration', $newpass);
        $mail_message='Dear '.$row[0]['name'].','. "\r\n";
        $mail_message.='Thanks for contacting regarding to forgot password,<br> Your <b>Password</b> is <b>'.$passwordplain.'</b>'."\r\n";
        $mail_message.='<br>Please Update your password.';
        $mail_message.='<br>Thanks & Regards';
        $mail_message.='<br>Your company name';
        require 'PHPMailerAutoload.php';
        require 'class.phpmailer.php';
        $mail = new PHPMailer;
        $mail->IsSendmail();
        $mail->isSMTP();
        $mail->SMTPAuth = true;
        $mail->Host = "hostname";
        $subject = 'Testing Email';
        $mail->AddAddress($email);
        $mail->IsMail();
        $mail->From = 'admin@***.com';
        $mail->FromName = 'admin';
        $mail->IsHTML(true);
        $mail->Subject = $subject;
        $mail->Body    = $mail_message;
        $mail->Send();
        if (!$mail->send()) {

            echo "<script>alert('msg','Failed to send password, please try again!')</script>";
        } else {

            echo "<script>alert('msg','Password sent to your email!')</script>";
        }
        redirect(base_url().'Jobseeker/index','refresh');
    }
    else
    {

        echo "<script>alert('msg','Email not found try again!')</script>";
        redirect(base_url().'Jobseeker/index','refresh');
    }
}