public function add() { must_authenticated(site_url('merchant/add'), USER_ROLE_ADMIN); $this->load->helper('form'); $this->load->helper('security'); $this->load->library('form_validation'); if ($this->input->server('REQUEST_METHOD') == "POST") { $this->do_add_merchant(); } render('merchant/add', '', ''); }
public function upload_profpic() { must_authenticated(site_url('people/profile'), USER_ROLE_USER); $user = $this->user_model->get_user(); $config = array('upload_path' => FCPATH . "images/user", 'allowed_types' => "jpg|png|jpeg", 'overwrite' => FALSE, "encrypt_name" => TRUE); $this->load->library('upload', $config); if ($this->upload->do_upload('userfile')) { $data = array('upload_data' => $this->upload->data()); $update_data["profile_picture"] = $data["upload_data"]["file_name"]; $this->user_model->update($update_data, $user["user_id"]); $this->session->set_flashdata("error", "Success!"); redirect(base_url() . 'people/profile', 'refresh'); } else { $this->session->set_flashdata("error", $this->upload->display_errors()); } redirect(base_url() . 'people/profile', 'refresh'); }
function print_voucher() { must_authenticated(site_url('merchant/add'), USER_ROLE_USER); if ($this->input->server('REQUEST_METHOD') == "POST") { $id = $this->input->get('voucher_detail_id'); $voucher_code = $this->input->get('voucher_code'); $data['voucher'] = $this->voucher_model->print_voucher($id, $voucher_code); if ($data['voucher']) { $this->load->view('voucher/print', $data); return; } } show_404(); }
function payment_confirmation() { must_authenticated('', USER_ROLE_USER); if ($this->input->server('REQUEST_METHOD') == "POST") { $this->load->helper('security'); $this->load->model('tx_model'); $this->load->library('form_validation'); $order_id = xss_clean($this->input->post('order_id')); if ($this->tx_model->is_valid_order_id($order_id)) { $this->form_validation->set_rules('bank_account', 'Bank Account', 'required|max_length[100]'); $this->form_validation->set_rules('payment_date', 'Payment Date', 'required'); $this->form_validation->set_rules('sender_account_name', 'Nama Pemilik Rekening', 'required'); $this->form_validation->set_rules('nominal_transfer', 'Nominal Transfer', 'required|is_natural_no_zero'); if ($this->form_validation->run() == TRUE) { $user_id = $this->user_model->user_id(); $bank_account = xss_clean($this->input->post('bank_account')); $payment_date = xss_clean($this->input->post('payment_date')); $sender_account_name = xss_clean($this->input->post('sender_account_name')); $nominal_transfer = xss_clean($this->input->post('nominal_transfer')); $data = array(); $data['order_id'] = $order_id; $data['user_id'] = $user_id; $data['bank_account'] = $bank_account; $data['sender_account_name'] = $sender_account_name; $data['nominal_transfer'] = $nominal_transfer; $data['payment_date'] = $payment_date; $data['status'] = PAYMENT_STATUS_WAITING_VERIFICATION; $this->tx_model->create_payment($data); redirect(site_url('tx/payment_success'), 'refresh'); } else { $this->session->set_flashdata("error_payment", validation_errors()); redirect(site('tx/order_detail') . '?id=' . $order_id, 'refresh'); } } } redirect(base_url() . 'home', 'refresh'); }