Advertisement
dewa_01

Untitled

Dec 15th, 2019
351
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.67 KB | None | 0 0
  1. <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
  2.  
  3. class Order extends CI_Controller {
  4.  
  5.     public function __construct()
  6.     {
  7.         parent::__construct();
  8.         if(!$this->session->userdata('username'))
  9.         {
  10.             redirect('login');
  11.         }
  12.         $this->load->model('model_orders');
  13.     }
  14.    
  15.     public function index()
  16.     {
  17.         $is_processed = $this->model_orders->process();
  18.         if($is_processed){
  19.             $this->cart->destroy();
  20.             redirect('order/success');
  21.         } else {
  22.             $this->session->set_flashdata('error','Failed to processed your order, please try again!');
  23.             redirect('welcome/cart');
  24.         }
  25.     }
  26.  
  27.     public function success()
  28.     {
  29.         $this->load->view('order_success');
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement