php - forgotten / reset password codeigniter issue -



php - forgotten / reset password codeigniter issue -

i setting forgotten password , reset form. when send email. have 2 issues. one unique code not showing in url on when click on link. , other issue having says message: undefined variable: message.

everything else works fine code not showing in url , $message error.

why not picking $code in url. , having error $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 security $config['smpt_password'] = '******'; // password blanked out 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'); homecoming $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'); } homecoming !$this->error; } }

found issue first $message . should $message no total stop. , code problem changed site_url base.

$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);

php codeigniter

Comments

Popular posts from this blog

assembly - What is the addressing mode for ld, add, and rjmp instructions? -

vowpalwabbit - Interpreting Vowpal Wabbit results: Why are some lines appended by "h"? -

Is there a way to convert an HTML page styled with Bootstrap CSS into email-compatible html? -