|
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/angkasapuraretail.com/public_html/application/controllers/ |
Upload File : |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Payment_confirmation extends CI_Controller {
function __construct() {
parent::__construct();
$this->load->model('configuration_m');
}
public function load_payment_page($order_id = null) {
//check if $order_id exists...
$this->db->select('*');
$this->db->from('orders');
$this->db->where('id_orders', $order_id);
$query = $this->db->get();
$rowcount = $query->num_rows();
if ($rowcount >= 1) {
$data['title'] = 'Registration';
$data['banner'] = $this->configuration_m->get_banner();
$data_order['order_id'] = (int) $order_id;
$this->load->view('templates/header', $this->data);
$this->load->view('upload_receipt', $data_order);
$this->load->view('templates/footer', $this->data_footer);
} else {
show_404();
}
}
public function upload_receipt() {
if (!isset($_POST['submit'])) {
redirect('products');
}
//Image receipt uploading
$config['upload_path'] = './assets/images';
$config['allowed_types'] = 'jpg|png|pdf';
$config['max_size'] = '500';
$this->load->library('upload', $config);
if ( ! $this->upload->do_upload()) {
$data['error'] = array('error' => $this->upload->display_errors());
redirect('payment_confirmation/load_payment_page' . $this->input->post('order_id'));
} else {
$image = $this->upload->data();
$data = array(
'image_receipt' => $image['file_name']
);
$this->db->where('id_orders', (int) $this->input->post('order_id'));
$this->db->update('orders', $data);
$data['title'] = 'Registration';
$data['banner'] = $this->configuration_m->get_banner();
$this->load->view('templates/header', $this->data_header);
$this->load->view('upload_success');
$this->load->view('templates/footer');
}
}
}