예제 #1
0
 /**
  *
  */
 public function register()
 {
     $this->load->helper('form');
     $this->load->library('form_validation');
     $this->load->library("session");
     if ($this->form_validation->run('user/register') === FALSE) {
         $this->load->view("templates/errorForm.php", array("fields" => array('email', 'username', 'password', 'captcha')));
     } else {
         $this->user->registerStudent($this->input->post("username"), $this->input->post("password"), $this->input->post("email"));
         try {
             $this->user->save();
             $this->login();
         } catch (UsernameAlreadyExistException $e) {
             $this->load->view("user/user_error.php");
             User_Error::register_username_exist();
         } catch (EmailAlreadyExistException $e) {
             $this->load->view("user/user_error.php");
             User_Error::register_email_exist();
         }
     }
 }