application/controllers/Users.php
/*DOCU This function is triggered when the user fills up the registration form 
	Checks if the entered fields are valid, alerts the user for any error on the form
	Owner:Philip */
DOCU This function is triggered when the user fills up the registration form
Checks if the entered fields are valid, alerts the user for any error on the form
Owner:Philip
DOCU This function is triggered when the user fills up the registration form Checks if the entered fields are valid alerts the user for any error on the form Owner : Philip
public function process_registration() {
		$this->form_validation->set_rules("email", "Email", "required|valid_email");
		$this->form_validation->set_rules("first_name", "First name", "required|min_length[3]");
		$this->form_validation->set_rules("last_name", "Last name", "required|min_length[2]");
		$this->form_validation->set_rules("password", "Password", "required|min_length[6]|matches[confirm]");
		$this->form_validation->set_rules("confirm", "Confirm password", "required|matches[password]");
		if ($this->form_validation->run() == FALSE) {
			$this->session->set_flashdata("email_taken", "");
            $this->load->view('register');
        }
        else {
			$email = $this->input->post("email");
            $user = $this->user->get_user_by_email($this->security->xss_clean($email));
			if(empty($user)) {
				$password = $this->security->xss_clean($this->input->post("password"));
				$data = array(
					"email" => $this->security->xss_clean($email),
					"first_name" => $this->security->xss_clean($this->input->post("first_name")),
					"last_name" => $this->security->xss_clean($this->input->post("last_name")),
					"user_level" => "user",
					"password" => md5($password)
				);
				$this->user->save_user($data);
				$this->load->view("signin");
			}
			else {
				$this->session->set_flashdata("email_taken", "Email already taken!");
				$this->load->view('register');
			}
        }
	}
public function process_registration ( ) { $ this -> form_validation -> set_rules ( " email " , " Email " , " required|valid_email " ) ; $ this -> form_validation -> set_rules ( " first_name " , " First name " , " required|min_length[3] " ) ; $ this -> form_validation -> set_rules ( " last_name " , " Last name " , " required|min_length[2] " ) ; $ this -> form_validation -> set_rules ( " password " , " Password " , " required|min_length[6]|matches[confirm] " ) ; $ this -> form_validation -> set_rules ( " confirm " , " Confirm password " , " required|matches[password] " ) ; if ( $ this -> form_validation -> run ( ) == FALSE ) { $ this -> session -> set_flashdata ( " email_taken " , " " ) ; $ this -> load -> view ( 'register' ) ; } else { $ email = $ this -> input -> post ( " email " ) ; $ user = $ this -> user -> get_user_by_email ( $ this -> security -> xss_clean ( $ email ) ) ; if ( empty ( $ user ) ) { $ password = $ this -> security -> xss_clean ( $ this -> input -> post ( " password " ) ) ; $ data = array ( " email " => $ this -> security -> xss_clean ( $ email ) , " first_name " => $ this -> security -> xss_clean ( $ this -> input -> post ( " first_name " ) ) , " last_name " => $ this -> security -> xss_clean ( $ this -> input -> post ( " last_name " ) ) , " user_level " => " user " , " password " => md5 ( $ password ) ) ; $ this -> user -> save_user ( $ data ) ; $ this -> load -> view ( " signin " ) ; } else { $ this -> session -> set_flashdata ( " email_taken " , " Email already taken! " ) ; $ this -> load -> view ( 'register' ) ; } } }
DOCU This function is triggered when the user fills up the registration form
Checks if the entered fields are valid, alerts the user for any error on the form
Owner:Philip
DOCU This function is triggered when the user fills up the registration form Checks if the entered fields are valid alerts the user for any error on the form Owner : Philip