application/controllers/Users.php
/*DOCU This function is triggered when the user fills up the signin 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 signin 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 signin form Checks if the entered fields are valid alerts the user for any error on the form Owner : Philip
public function process_signin() {
		$this->form_validation->set_rules("email", "Email", "required|valid_email");
		$this->form_validation->set_rules("password", "Password", "required");
		if ($this->form_validation->run() == FALSE) {
            $this->load->view('signin');
        }
        else {
			$email = $this->security->xss_clean($this->input->post("email"));
			$password = $this->security->xss_clean($this->input->post("password"));
            $enc_password = md5($password);
			$query = $this->user->get_user_by_email($email);
			if($query[0]->password == $enc_password) {
				$this->session->set_userdata("user", $query[0]);
				if($query[0]->user_level == "admin") {
					$data["users"] = $this->user->get_users();
					redirect("admin");
				}
				else {
					redirect("users/user_dashboard");
				}
			}
			else {
				$this->session->set_flashdata("signin_error", "Incorrect username or password");
				$this->load->view('signin');
			}
        }
	}
public function process_signin ( ) { $ this -> form_validation -> set_rules ( " email " , " Email " , " required|valid_email " ) ; $ this -> form_validation -> set_rules ( " password " , " Password " , " required " ) ; if ( $ this -> form_validation -> run ( ) == FALSE ) { $ this -> load -> view ( 'signin' ) ; } else { $ email = $ this -> security -> xss_clean ( $ this -> input -> post ( " email " ) ) ; $ password = $ this -> security -> xss_clean ( $ this -> input -> post ( " password " ) ) ; $ enc_password = md5 ( $ password ) ; $ query = $ this -> user -> get_user_by_email ( $ email ) ; if ( $ query [ 0 ] -> password == $ enc_password ) { $ this -> session -> set_userdata ( " user " , $ query [ 0 ] ) ; if ( $ query [ 0 ] -> user_level == " admin " ) { $ data [ " users " ] = $ this -> user -> get_users ( ) ; redirect ( " admin " ) ; } else { redirect ( " users/user_dashboard " ) ; } } else { $ this -> session -> set_flashdata ( " signin_error " , " Incorrect username or password " ) ; $ this -> load -> view ( 'signin' ) ; } } }
DOCU This function is triggered when the user fills up the signin 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 signin form Checks if the entered fields are valid alerts the user for any error on the form Owner : Philip