Advertisement
Guest User

Untitled

a guest
Jul 3rd, 2017
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.99 KB | None | 0 0
  1. <?php
  2.  
  3. class Registration extends Controller {
  4.      
  5.   function Registration()  {
  6.     parent::Controller();  
  7.  
  8.     $this->load->model('Page');
  9.     $this->load->model('User');
  10.    
  11.     $this->load->helper(array('form','url'));
  12.     $this->load->library('form_validation');
  13.   }
  14.  
  15.   function index($err = FALSE) {
  16.     $data['pages'] = $this->Page->getPages(0);
  17.     $data['id'] = 2;
  18.    
  19.     $this->load->view('header_view', $data);
  20.    
  21.     $data = '';
  22.     $data['err'] = $err;
  23.    
  24.     $this->load->view('registration_view', $data);
  25.     $this->load->view('footer_view');
  26.   }
  27.  
  28.   function submit() {
  29.     $u = new User();
  30.     $u->username = $this->input->post('username');
  31.     $u->password = $this->input->post('password');
  32.     $u->confirm_password = $this->input->post('confirm_password');
  33.     $u->email = $this->input->post('email');
  34.    
  35.     if ($u->save()) {
  36.       $this->load->view('submit_view');
  37.     } else {
  38.       $this->index($u->error->string);
  39.     }
  40.   }
  41.  
  42. }
  43.  
  44. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement