2017-03-06 48 views
0

我想設置會話超時爲OTP設置會話超時爲OTP,設定的時間後OTP到期如何使用笨

Controlller代碼如下圖所示

$six_digit_random_number = mt_rand(100000, 999999);     
    $this->session->set_userdata('otp', $six_digit_random_number); 
        $this->load->model('Login_model'); 
    $pass['pass'] = $this->Login_model->forgot_pass_retrive($emailTo); 
        $config['protocol'] = 'smtp'; 
        $config['smtp_host'] = 'ssl://smtp.gmail.com'; 
        $config['smtp_port'] = '465'; 
        $config['smtp_timeout'] = '7'; 
        $config['smtp_user'] = '[email protected]'; 
        $config['smtp_pass'] = '87xxxxxxxx'; 
        $config['charset'] = 'utf-8'; 
        $config['newline'] = "\r\n"; 
        $config['mailtype'] = 'text'; 
        $config['validation'] = TRUE; 
        $this->email->initialize($config); 
     $this->email->from('[email protected]', 'Terasukhintrade'); 
        $this->email->to($emailTo); 
        $this->email->subject('Reset your password'); 
        $this->email->message('Click on link to reset your password '.$this->session->userdata['otp']); 

        $this->email->send(); 

        echo $this->email->print_debugger(); 

        $this->load->view('login',$data); 
       } else { 

        $this->session->set_flashdata('message', ' Email address not found!'); 
        $this->load->view('login',$data); 
       } 

      } 
     } 

回答