Guest User

Untitled

a guest
Jun 28th, 2018
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.99 KB | None | 0 0
  1. public function register() {
  2.        
  3.         $this->load->view('topspace');
  4.         $this->load->helper(array('form', 'url'));
  5.         $this->load->library('form_validation');
  6.        
  7.         $this->form_validation->set_rules('email', 'Email', 'required');
  8.         $this->form_validation->set_rules('password', 'Password', 'required');
  9.         $this->form_validation->set_rules('firstname', 'First Name', 'required');
  10.         $this->form_validation->set_rules('lastname', 'Last Name', 'required');
  11.         $this->form_validation->set_rules('streetaddress', 'Street Address', 'required');
  12.         $this->form_validation->set_rules('city', 'City', 'required');
  13.         $this->form_validation->set_rules('state', 'State', 'required');
  14.         $this->form_validation->set_rules('zip', 'Zip', 'required');
  15.        
  16.         if ($this->form_validation->run() == TRUE)
  17.                 {
  18.                     $username = $this->input->post('email');
  19.                     $email = $this->input->post('email');
  20.                     $password = $this->input->post('password');
  21.                     $confirmpassword = $this->input->post('confirmpassword');
  22.                    
  23.                     $firstname = $this->input->post('firstname');
  24.                     $lastname = $this->input->post('lastname');
  25.                     $streetaddress = $this->input->post('streetaddress');
  26.                     $city = $this->input->post('city');
  27.                     $state = $this->input->post('state');
  28.                     $zip = $this->input->post('zip');
  29.                    
  30.                     $additional_data = array(
  31.                                 'first_name' => $firstname,
  32.                                 'last_name' => $lastname,
  33.                                 'streetaddress' => $streetaddress,
  34.                                 'city' => $city,
  35.                                 'state' => $state,
  36.                                 'zip' => $zip
  37.                                 );
  38.                     $group = 'members';
  39.                     if ($password == $confirmpassword) {
  40.                    
  41.                     if($this->ion_auth->register($username, $password, $email, $additional_data, $group)){                 
  42.                         $this->load->view('register_success');
  43.                     }else{
  44.                         $this->load->view('duplicateuser');
  45.                     }
  46.                     } else {
  47.                         $this->load->view('confirmpasswordfail');
  48.                     }
  49.                 }
  50.                 else
  51.                 {
  52.                         $this->load->view('register');
  53.                 }
  54.        
  55.         }
Add Comment
Please, Sign In to add comment