|
Server : Apache/2.4.18 (Ubuntu) System : Linux canvaswebdesign 3.13.0-71-generic #114-Ubuntu SMP Tue Dec 1 02:34:22 UTC 2015 x86_64 User : oppastar ( 1041) PHP Version : 7.0.33-0ubuntu0.16.04.15 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, Directory : /var/www/rabbithabit.com/public_html/application/controllers/ |
Upload File : |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Verify_registration extends Public_Controller {
function __construct() {
parent::__construct();
$this->load->model('customer_m');
}
public function verify($random_hash = NULL, $customer_id = NULL) {
if ($random_hash == NULL || $customer_id == NULL) { show_404(); }
//check if $random_hash & id is exist
$count = $this->db->select('random_hash, id_customers')->from('customers')->where('random_hash', $random_hash)->where('id_customers', (int) $customer_id)->get()->num_rows();
if ($count == 0) { show_404(); }
//set status to become 1
$data = array(
'status' => 1
);
$this->db->where('id_customers', (int) $customer_id);
$this->db->where('random_hash', $random_hash);
$this->db->update('customers', $data);
//email welcome message to customer..
//get customer data
$customer_data = $this->db->select('name, email')->from('customers')->where('id_customers', (int) $customer_id)->get()->row();
$email_data['customer_name'] = $customer_data->name;
$email_data['email'] = $customer_data->email;
$email_data['subject'] = 'Welcome';
if($this->session->userdata('site_lang')== 'english') {
$view_file = 'email/english/account';
} else {
$view_file = 'email/indonesian/account';
}
$this->send_email($view_file, $email_data); //send email function in my_controller
if($this->session->userdata('site_lang') == 'english') {
$this->session->set_flashdata('confirmation', "<div style='font-size:1.2em; color:#2B286E; border:1px solid #2B286E; padding:5px;'><strong> You account is now active. Please login to continue.</strong></div>");
} else {
$this->session->set_flashdata('confirmation', "<div style='font-size:1.2em; color:#2B286E; border:1px solid #2B286E; padding:5px;'><strong> Akun Anda telah aktif. Silahkan login.</strong></div>");
}
redirect('login');
//log the customer in..
/* $this->db->select('name, email, id_customers')->from('customers')->where('id_customers', (int) $customer_id);
$customer_detail = $this->db->get()->row();
//save customer data to current session
$customer_data = array(
'customer_name' => $customer_detail->name,
'customer_email' => $customer_detail->email,
'customer_id' => $customer_detail->id_customers,
'customer_loggedin' => TRUE
);
$this->session->set_userdata(array('customer' => $customer_data));
if($this->session->userdata('customer')['customer_loggedin'] == TRUE) {
if ($this->session->userdata('is_from_cart') == 'yes') {
redirect('summary');
} else {
redirect(base_url('welcome'));
}
} */
}
}