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/kamariallee.com/public_html/application/controllers/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /var/www/kamariallee.com/public_html/application/controllers/Account.php
<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Account extends Customer_Controller {

	public function __construct() { 
		
		parent::__construct();
		$this->load->model('customer_m'); 
		$this->load->library('form_validation');

		//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 Account'; 
		$this->data_header['meta_description'] = ucwords($website_name->website_name) . ' - My Account'; 
		$this->data_header['meta_keywords'] = $website_name->meta_keywords;  
	}

	public function index() { 

		redirect('account/order_history');
		
		$this->load->view('template/header', $this->data_header); 
		$this->load->view('account/index');
		$this->load->view('template/footer', $this->data_footer); 
	}

	public function profile() { 

		$this->data_header['page_title'] = 'My Profile';

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

		$data['customer'] = $this->customer_m->get_customer($id_customer);

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

	public function update_profile() 
	{
		if (!isset($_POST['update_profile'])) 
		{ 
				redirect('account/profile'); 
		}

		//validation in action
		$rules = $this->customer_m->profile_rules;       

		$this->form_validation->set_rules($rules); 

		if($this->form_validation->run($this) == FALSE) 
		{  
				$this->profile();

		} 
		else 
		{

			if (! $this->input->post('password')) {
				
				$data = array(
					'name' => $this->input->post('name'),
				);
	
			} else {

				$data = array(
					'name' => $this->input->post('name'),
					'password' => $this->customer_m->hash($this->input->post('password')),
				);
			}

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

			$this->customer_m->update_profile($id_customer, $data); 

			$this->session->set_flashdata('confirmation', "Profile saved"); 

			redirect('account/profile');	
		}

	}

	public function shipping() 
	{ 
			//this is to check whether from summary page want to update shipping details. if yes, then later redirect back to summary page
			if (isset($_POST['shipping_summarypage'])) { 	 
				$this->session->set_userdata('shipping_summarypage', TRUE);
			}

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

			//get customer shipping address detail
			$data['shipping'] = $this->customer_m->get_shipping($id_customer);  
			
			//get provinces
			$data['provinces'] = $this->db->select('*')->from('indonesia_provinces')->order_by('province', 'ASC')->get()->result_array();

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

	function update_shipping()
  {
			if (!isset($_POST['shipping'])) 
			{
					redirect('account/shipping');
			}

			$rules = array(
					'recipient_name' => array(
							'field'=>'recipient_name', 
							'label'=>'Delivery Name', 
							'rules'=>'trim|required'),

					'shipping_address' => array(
							'field'=>'shipping_address', 
							'label'=>'Delivery Address', 
							'rules'=>'trim|required'),

					'id_province' => array(
							'field'=>'id_province', 
							'label'=>'Province ID', 
							'rules'=>'trim|required'),

					'id_district' => array(
							'field'=>'id_district', 
							'label'=>'District ID', 
							'rules'=>'trim|required'),

					'id_city' => array(
							'field'=>'id_city', 
							'label'=>'City ID', 
							'rules'=>'trim|required'),

					'shipping_phone' => array(
							'field'=>'shipping_phone', 
							'label'=>'Delivery Phone', 
							'rules'=>'trim|required'),
	
					'shipping_email' => array(
							'field'=>'shipping_email', 
							'label'=>'Delivery Email', 
							'rules'=>'trim|required|valid_email'),

					'postcode' => array(
							'field'=>'postcode', 
							'label'=>'Postcode', 
							'rules'=>'trim|required'),      		
			); 

			$this->form_validation->set_rules($rules); 
			$this->form_validation->set_error_delimiters('<div class="error">', '</div>');
			if($this->form_validation->run($this) == FALSE) 
			{  
					redirect('account/shipping');
			} 
			else 
			{
					$id_customer = (int) $this->session->userdata('customer')['customer_id'];

					$data = array(
							'recipient_name' => $this->security->xss_clean($this->input->post('recipient_name')), 
							'shipping_name' => $this->security->xss_clean($this->input->post('recipient_name')), 
							'shipping_phone' => $this->security->xss_clean($this->input->post('shipping_phone')), 
							'phone' => $this->security->xss_clean($this->input->post('shipping_phone')), 
							'shipping_address' => $this->security->xss_clean($this->input->post('shipping_address')), 
							'address' => $this->security->xss_clean($this->input->post('shipping_address')), 
							'shipping_email' => $this->security->xss_clean($this->input->post('shipping_email')), 
							'id_province' => $this->security->xss_clean($this->input->post('id_province')), 
							'shipping_id_province' => $this->security->xss_clean($this->input->post('id_province')), 
							'id_district' => $this->security->xss_clean($this->input->post('id_city')), 
							'shipping_id_district' => $this->security->xss_clean($this->input->post('id_city')), 
							'id_subdistrict' => $this->security->xss_clean($this->input->post('id_district')), 
							'shipping_id_subdistrict' => $this->security->xss_clean($this->input->post('id_district')),
							'postcode' => $this->security->xss_clean($this->input->post('postcode')), 
							'shipping_postcode' => $this->security->xss_clean($this->input->post('postcode')), 
					); 

					//get province
					$province = $this->db->select('province')->from('indonesia_provinces')->where('rajaongkir_province_id', $data['id_province'])->get()->row_array();

					if($province) 
					{
							$data['province'] = $province['province'];
							$data['shipping_province'] = $province['province'];
					}

					//get city
					$city = $this->db->select('district')->from('indonesia_districts')->where('rajaongkir_id_district', $data['id_district'])->get()->row_array();

					if($city) 
					{
							$data['district'] = $city['district'];
							$data['shipping_district'] = $city['district'];
					}

					//get district
					$district = $this->db->select('subdistrict')->from('indonesia_subdistricts')->where('rajaongkir_id_subdistrict', $data['id_subdistrict'])->get()->row_array();

					if($district) 
					{
							$data['subdistrict'] = $district['subdistrict'];
							$data['shipping_subdistrict'] = $district['subdistrict'];
					}

					$this->db->where('id_customers', $id_customer);
					$this->db->update('customers', $data); 

					$this->session->set_flashdata('confirmation', "Delivery details saved"); 

					redirect('account/shipping');
			}
  }

	public function order_history() { 

		$this->load->model('order_m');

		$this->data_header['page_title'] = 'Order History';

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

		$data['order_history'] = $this->order_m->get_order_history($id_customer); 

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

	private function point_rewards() { 

		$this->load->model('order_m');

		$this->data_header['page_title'] = 'My Point rewards';

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

		$data['order_history'] = $this->order_m->get_order_history($id_customer); 

		//get customer current point rewards
		$this->db->select('current_pointreward')->from('customers')->where('id_customers', $this->session->userdata('customer')['customer_id']);
		$data['current_point'] = $this->db->get()->row()->current_pointreward;

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

	public function payment_confirmation() {

		if (!isset($_POST['confirm_payment'])) {
			redirect('account/order_history');
		}

		$data['order_id'] = (int) $this->input->post('order_id');

		$this->data_header['page_title'] = 'Payment Confirmation';

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

	public function update_paymentconfirmation() {

		if (!isset($_POST['update_paymentconfirmation'])) {
			
			redirect('account/order_history');
		}

		//validation in action
		$config = array( 
                array(
                     'field'   => 'payment_date',
                     'label'   => 'Payment Date',
                     'rules'   => 'trim|required'
                  ),
                array(
                     'field'   => 'total_amount',
                     'label'   => 'Total Amount',
                     'rules'   => 'trim|required|numeric'
                  ),
                array(
                     'field'   => 'to_bank',
                     'label'   => 'To Bank',
                     'rules'   => 'trim'
                  ),
                array(
                     'field'   => 'from_bank',
                     'label'   => 'From Bank',
                     'rules'   => 'trim|required'
                  ),
                array(
                     'field'   => 'account_name',
                     'label'   => 'Account Name',
                     'rules'   => 'required|trim'
                  ),
				array(
                     'field'   => 'account_number',
                     'label'   => 'Account Number',
                     'rules'   => 'required|trim'
                  )
            );

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

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

			$data['order_id'] = (int) $this->input->post('order_id'); 

			$data_header['page_title'] = 'Payment Confirmation';

			$this->load->view('template/header', $data_header);
			$this->load->view('account/payment_confirmation', $data); 
			$this->load->view('template/footer', $this->data_footer); 
		
		} else {
			
			$payment_date = explode('-', $this->input->post('payment_date'));
			$new_payment_date = $payment_date['2'] . '-' . $payment_date['1'] . '-' . $payment_date['0'];
			
			$total_amount = (int) $this->input->post('total_amount');
			$to_bank = ucwords($this->input->post('to_bank'));
			$from_bank = ucwords($this->input->post('from_bank'));
			$account_name = ucwords($this->input->post('account_name'));
			$account_number = ucwords($this->input->post('account_number'));

			$payment_confirm_details = 
			'<p>Payment Date: ' . date('d M Y', strtotime($new_payment_date)) . '</p>' .
			'<p>Payment Amount: Rp ' . number_format($total_amount) . '</p>' .
			'<p>To Bank: ' . $to_bank . '</p>' .
			'<p>From Bank: ' . $from_bank . '</p>' .
			'<p>From Acc Name: ' . $account_name . '</p>' . 
			'<p>From Acc No: ' . $account_number . '</p>';

			$data = array(
				'payment_confirm' => 1,
				'payment_confirm_details' => $payment_confirm_details,				
			);

			$order_id = (int) $this->input->post('order_id'); 

			$this->db->where('id_orders', $order_id);
			$this->db->update('orders', $data);	

			//sending email
			//----SEND EMAIL TO ADMIN WEBSITE
			//get customer name
			$customer_id = (int) $this->session->userdata('customer')['customer_id'];
			$this->db->select('name')->from('customers')->where('id_customers', $customer_id);
			$data['customer_name'] = $this->db->get()->row()->name;

			//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;

			$this->load->model('configuration_m');

			$data['emails'] = $this->configuration_m->get_emails();  
			$data['bank'] = $this->configuration_m->get_bank();   
			$data['title'] = 'Customer Payment Confirmation'; 

			$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($data['emails']->from_email, $data['emails']->website_name);
			$this->email->to($data['emails']->from_email); 
			$this->email->subject('Customer Payment Confirmation'); 

			$myMessage = '<html><body>';
			$myMessage .= '<table style="border-color: #666;" cellpadding="10">';
			$myMessage .= "<tr><td><strong>Order No:</strong> </td><td>" . $order_id . "</td></tr>";
			$myMessage .= "<tr><td><strong>Payment Date:</strong> </td><td>" . $this->input->post('payment_date') . "</td></tr>";
			$myMessage .= "<tr><td><strong>Amount: Rp </strong> </td><td>" . 
			number_format($total_amount) . "</td></tr>";
			$myMessage .= "<tr><td><strong>To Bank:</strong> </td><td>" . $to_bank . "</td></tr>";
			$myMessage .= "<tr><td><strong>From bank:</strong> </td><td>" . $from_bank . "</td></tr>";
			$myMessage .= "<tr><td><strong>Account Name:</strong> </td><td>" . $account_name . "</td></tr>";
			$myMessage .= "<tr><td><strong>Account Number:</strong> </td><td>" . $account_number . "</td></tr>";
			$myMessage .= "</table>";
			$myMessage .= "<p>Please verify the payment, and change the payment status at Admin Dashboard.</p>";
			$myMessage .= "</body></html>";

			$this->email->message($myMessage);	    
			$this->email->send();  
			//----end send email 
             	
			$this->session->set_flashdata('success', '<br><p style="background:green; color:white; padding:10px; padding:5px; font-weight:bold;">Payment Confirmation Success. We will verify your payment and notify You back.</p>');
				
			redirect('account/order_history');	
		}

	}


	public function ajax_get_district() {

		//test if ajax call to prevent direct access
		if (!$this->input->is_ajax_request()) {
   			exit('No direct script access allowed');
		}

		$province_id = (int) $this->input->post('id_province'); 

		//get list of districts
		$this->db->select('*');	
		$this->db->from('districts');
		$this->db->where('id_provinces', $province_id);
		$this->db->order_by('name', 'ASC');
		$query = $this->db->get();
		$data['districts'] = $query->result();

		//get current selected district
		$id_customer = (int) $this->session->userdata('customer')['customer_id'];

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

		$this->load->view('ajax_get_district', $data);

	}


	public function ajax_edit_district() {

		//test if ajax call to prevent direct access 
		if (!$this->input->is_ajax_request()) {
   			exit('No direct script access allowed');
		}

		$this->load->helper('rajaongkir');

		$province_id = (int) $this->input->post('id_province'); 

		//get list of districts /cities from RajaOngkir.com API
		$data['districts'] = get_rajaongkir_data('city?province=' . $province_id); //get from helper file

		$this->load->view('ajax_edit_district', $data); 

	}

	public function ajax_get_shipping_district() {

		//test if ajax call to prevent direct access
		if (!$this->input->is_ajax_request()) {
   			exit('No direct script access allowed');
		}

		$shipping_province_id = (int) $this->input->post('id_shipping_province'); 

		//get list of districts
		$this->db->select('*');	
		$this->db->from('districts');
		$this->db->where('id_provinces', $shipping_province_id);
		$this->db->order_by('name', 'ASC');
		$query = $this->db->get();
		$data['shipping_districts'] = $query->result();

		//get current selected district
		$id_customer = (int) $this->session->userdata('customer')['customer_id'];

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

		$this->load->view('ajax_get_district', $data);

	}


	public function ajax_edit_shipping_district() {

		//test if ajax call to prevent direct access 
		if (!$this->input->is_ajax_request()) {
   			exit('No direct script access allowed');
		}

		$this->load->helper('rajaongkir');

		$shipping_province_id = (int) $this->input->post('id_shipping_province'); 

		//get list of districts /cities from RajaOngkir.com API
		$data['shipping_districts'] = get_rajaongkir_data('city?province=' . $shipping_province_id); //get from helper file

		$this->load->view('ajax_edit_shipping_district', $data);

	}
}

https://t.me/RX1948 - 2025