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/mesinpolesshinemate.com/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 $this->db->select('random_hash, id_customers')->from('customers')->where('random_hash', $random_hash)->where('id_customers', (int) $customer_id); $count = $this->db->get()->num_rows(); if ($count == 0) { show_404(); } //add new point rewards to customer $this->db->select('first_customer')->from('point_rewards')->where('id_point_rewards', 1); $point_rewards = (int) $this->db->get()->row()->first_customer; //set status to become 1 $data = array( 'status' => 1, ); if($point_rewards > 0) { $data['current_pointreward'] = $point_rewards; } $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 $this->db->select('name, email')->from('customers')->where('id_customers', (int) $customer_id); $customer_data = $this->db->get()->row(); $data['customer_name'] = $customer_data->name; $data['customer_email'] = $customer_data->email; //get website data $this->db->select('logo, from_email, website_name, email_smtp_host, email_smtp_port, email_smtp_password, email_smtp')->from('configuration')->where('id_configuration', 1); $website_data = $this->db->get()->row(); $data['logo'] = $website_data->logo; $data['website_name'] = $website_data->website_name; //get bonus pointrewards if($point_rewards > 0) { $data['pointrewards'] = $point_rewards; } $this->load->library('email'); //get email setting $config['protocol'] = 'smtp'; $config['smtp_host'] = $website_data->email_smtp_host; $config['smtp_port'] = $website_data->email_smtp_port; $config['smtp_user'] = $website_data->email_smtp; $config['smtp_pass'] = $website_data->email_smtp_password; $config['mailtype'] = 'html'; $config['charset'] = 'iso-8859-1'; $config['wordwrap'] = TRUE; $config['newline'] = "\r\n"; //use double quotes to comply with RFC 822 standard $this->email->initialize($config); $this->email->from($website_data->from_email, $website_data->website_name); $this->email->to($data['customer_email']); $this->email->subject('Welcome'); $email = $this->load->view('email/account', $data, TRUE); $this->email->message($email); $this->email->send(); //----end send email $this->session->set_flashdata('error', "<div style='font-size:1.4em; color:green;'><strong>YOUR ACCOUNT IS ACTIVATED.<br>PLEASE LOGIN TO CONTINUE.</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')); } } */ } }