2014-10-24 2 views
0

잊어 버린 암호를 설정하고 양식을 재설정하고 있습니다. 내 이메일을 보낼 때. 나는 2 가지 이슈가있다. 링크를 클릭하면 고유 한 코드가 URL에 표시되지 않습니다. 그리고 제가 가지고있는 다른 문제는 Message: Undefined variable: message입니다.암호를 잊어 버리거나 암호를 잊어 버렸습니다.

다른 모든 것은 정상적으로 작동하지만 코드는 URL에 나타나지 않으며 $message 오류가 발생합니다.

URL에 내 $code이 수신되지 않는 이유는 무엇입니까? 그리고 $message 오류가 있습니까?

<?php if (! defined('BASEPATH')) exit('No direct script access allowed'); 

class Forgotten extends MX_Controller { 
private $error = array(); 

public function __construct() { 
    parent::__construct(); 
    if ($this->user->hasPermissionAccess() == TRUE) { 
     $this->lang->load('admin/english', 'english'); 
     $this->lang->load('admin/common/forgotten', 'english'); 
     $this->load->library('settings'); 
     $this->load->library('pagination'); 
     $this->load->library('request'); 
     $this->load->library('response'); 
     $this->load->library('document'); 
    } else { 
     redirect('admin/error'); 
    } 
} 

public function index() { 
    $this->document->setTitle($this->lang->line('heading_title')); 

    if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) { 

     $this->load->library('email'); 

     $config['protocol'] = 'smpt'; 
     $config['smpt_host'] = 'ssl://squid.arvixe.com'; 
     $config['smpt_port'] = '465'; 
     $config['smpt_user'] = '********'; // Username Blanked Out For Security 
     $config['smpt_password'] = '******'; // Password Blanked Out For Security 

     $this->email->initialize($config); 

     $this->email->from($config['smpt_user']); 
     $this->email->to($this->request->post['email']); 
     $subject = sprintf($this->lang->line('text_subject'), $this->settings->get('config_name')); 

     $this->email->subject($subject); 

     $code = sha1(uniqid(mt_rand(), true)); 

     $this->load->model('admin/user/users_model'); 
     $this->users_model->editCode($this->request->post['email'], $code); 

     $message .= sprintf($this->lang->line('text_greeting'), $this->settings->get('config_name')) . "\n\n"; 
     $message .= $this->lang->line('text_change') . "\n\n"; 
     $code = sha1(uniqid(mt_rand(), true)); 
     $message .= site_url('admin/reset/', $code) . "\n\n"; 
     $message .= sprintf($this->lang->line('text_ip'), $this->request->server['REMOTE_ADDR']) . "\n\n"; 
     $this->email->message($message); 

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

    $data['breadcrumbs'] = array(); 

    $data['breadcrumbs'][] = array(
    'text' => '<i class="fa fa-home"></i>' .' '. $this->lang->line('text_home'), 
    'href' => site_url('common/dashboard') 
    ); 

    $data['breadcrumbs'][] = array(
    'text' => $this->lang->line('heading_title'), 
    'href' => site_url('common/forgotten') 
    ); 

    if (isset($this->error['warning'])) { 
     $data['error_warning'] = $this->error['warning']; 
    } else { 
     $data['error_warning'] = ''; 
    } 

    $data['action'] = site_url('admin/forgotten'); 

    $data['cancel'] = site_url('admin'); 

    $data['heading_title'] = $this->lang->line('heading_title'); 

    $data['text_your_email'] = $this->lang->line('text_your_email'); 
    $data['text_email'] = $this->lang->line('text_email'); 

    $data['entry_email'] = $this->lang->line('entry_email'); 

    $data['button_reset'] = $this->lang->line('button_reset'); 
    $data['button_cancel'] = $this->lang->line('button_cancel'); 

    return $this->load->view('common/forgotten', $data); 
} 

public function validate() { 
    $this->load->model('admin/user/users_model'); 

    if (!isset($this->request->post['email'])) { 
     $this->error['warning'] = $this->lang->line('error_email'); 
    } elseif (!$this->users_model->getTotalUsersByEmail($this->request->post['email'])) { 
     $this->error['warning'] = $this->lang->line('error_email'); 
    } 

    return !$this->error; 

} 
} 
+0

어디서 오류가 발생합니까? edm/mail 템플리트 또는 재설정 비밀번호 URL에서. 재설정 비밀번호 url을 공유하십시오. – bhushya

+0

클릭하면 메시지 표시 : 정의되지 않은 변수 : 메시지를 보냅니다. –

답변

0

처음 발견 된 문제는 $message입니다. $message 전체 정지가 없어야합니다. 그리고 코드 문제 때문에 site_urlbase으로 변경했습니다.

$message = sprintf($this->lang->line('text_greeting'), $this->settings->get('config_name')) . "\n\n"; 
    $message .= $this->lang->line('text_change') . "\n\n"; 
    $code = sha1(uniqid(mt_rand(), true)); 
    $message .= base_url('admin/reset') . '/' . $code . "\n\n"; 
    $message .= sprintf($this->lang->line('text_ip'), $this->request->server['REMOTE_ADDR']) . "\n\n"; 
    $this->email->message($message); 
관련 문제