application/controllers/Institute.php
/******MANAGE OWN PROFILE AND CHANGE PASSWORD***/
MANAGE OWN PROFILE AND CHANGE PASSWORD
MANAGE OWN PROFILE AND CHANGE PASSWORD
function manage_profile($param1 = '', $param2 = '', $param3 = '')
    {
        if ($this->session->userdata('institute_login') != 1)
            redirect(base_url() . 'login', 'refresh');
        if ($param1 == 'update_profile_info') {
            $data['name_institute']  = $this->input->post('name');
            $data['email'] = $this->input->post('email');
            $this->db->where('id', $this->session->userdata('institute_id'));
            $this->db->update('institute', $data);
            move_uploaded_file($_FILES['userfile']['tmp_name'], 'uploads/institute_image/' . $this->session->userdata('institute_id') . '.jpg');
            $this->session->set_flashdata('flash_message', get_phrase('account_updated'));
            redirect(base_url() . 'institute/manage_profile/', 'refresh');
        }
        if ($param1 == 'change_password') {
            $data['password']             = $this->input->post('password');
            $data['new_password']         = $this->input->post('new_password');
            $data['confirm_new_password'] = $this->input->post('confirm_new_password');
            $current_password = $this->db->get_where('institute', array(
                'institute_id' => $this->session->userdata('institute_id')
            ))->row()->password;
            if ($current_password == $data['password'] && $data['new_password'] == $data['confirm_new_password']) {
                $this->db->where('institute_id', $this->session->userdata('institute_id'));
                $this->db->update('institute', array(
                    'password' => $data['new_password']
                ));
                $this->session->set_flashdata('flash_message', get_phrase('password_updated'));
            } else {
                $this->session->set_flashdata('flash_message', get_phrase('password_mismatch'));
            }
            redirect(base_url() . 'institute/manage_profile/', 'refresh');
        }
        $page_data['page_name']  = 'manage_profile';
        $page_data['page_title'] = get_phrase('manage_profile');
        $page_data['edit_data']  = $this->db->get_where('institute', array(
            'id' => $this->session->userdata('institute_id')
        ))->result_array();
        $this->load->view('backend/index', $page_data);
    }
function manage_profile ( $ param1 = '' , $ param2 = '' , $ param3 = '' ) { if ( $ this -> session -> userdata ( 'institute_login' ) != 1 ) redirect ( base_url ( ) . 'login' , 'refresh' ) ; if ( $ param1 == 'update_profile_info' ) { $ data [ 'name_institute' ] = $ this -> input -> post ( 'name' ) ; $ data [ 'email' ] = $ this -> input -> post ( 'email' ) ; $ this -> db -> where ( 'id' , $ this -> session -> userdata ( 'institute_id' ) ) ; $ this -> db -> update ( 'institute' , $ data ) ; move_uploaded_file ( $ _FILES [ 'userfile' ] [ 'tmp_name' ] , 'uploads/institute_image/' . $ this -> session -> userdata ( 'institute_id' ) . '.jpg' ) ; $ this -> session -> set_flashdata ( 'flash_message' , get_phrase ( 'account_updated' ) ) ; redirect ( base_url ( ) . 'institute/manage_profile/' , 'refresh' ) ; } if ( $ param1 == 'change_password' ) { $ data [ 'password' ] = $ this -> input -> post ( 'password' ) ; $ data [ 'new_password' ] = $ this -> input -> post ( 'new_password' ) ; $ data [ 'confirm_new_password' ] = $ this -> input -> post ( 'confirm_new_password' ) ; $ current_password = $ this -> db -> get_where ( 'institute' , array ( 'institute_id' => $ this -> session -> userdata ( 'institute_id' ) ) ) -> row ( ) -> password ; if ( $ current_password == $ data [ 'password' ] && $ data [ 'new_password' ] == $ data [ 'confirm_new_password' ] ) { $ this -> db -> where ( 'institute_id' , $ this -> session -> userdata ( 'institute_id' ) ) ; $ this -> db -> update ( 'institute' , array ( 'password' => $ data [ 'new_password' ] ) ) ; $ this -> session -> set_flashdata ( 'flash_message' , get_phrase ( 'password_updated' ) ) ; } else { $ this -> session -> set_flashdata ( 'flash_message' , get_phrase ( 'password_mismatch' ) ) ; } redirect ( base_url ( ) . 'institute/manage_profile/' , 'refresh' ) ; } $ page_data [ 'page_name' ] = 'manage_profile' ; $ page_data [ 'page_title' ] = get_phrase ( 'manage_profile' ) ; $ page_data [ 'edit_data' ] = $ this -> db -> get_where ( 'institute' , array ( 'id' => $ this -> session -> userdata ( 'institute_id' ) ) ) -> result_array ( ) ; $ this -> load -> view ( 'backend/index' , $ page_data ) ; }
MANAGE OWN PROFILE AND CHANGE PASSWORD
MANAGE OWN PROFILE AND CHANGE PASSWORD