Example #1
0
 function authenticate_user()
 {
     $user_model = new User_model();
     $user_service = new User_service();
     $user_model->set_user_name($this->input->post('login_username', TRUE));
     $user_model->set_password(md5($this->input->post('login_password', TRUE)));
     $result_user = $user_service->authenticate_user_with_password($user_model);
     if (count($result_user) == 0) {
         $logged_user_result = false;
     } else {
         $logged_user_result = true;
     }
     if ($logged_user_result) {
         $this->session->set_userdata('USER_ID', $result_user->id);
         $this->session->set_userdata('USER_FULLNAME', $result_user->name);
         $this->session->set_userdata('USER_NAME', $result_user->user_name);
         $this->session->set_userdata('USER_TYPE', $result_user->user_type);
         $this->session->set_userdata('USER_EMAIL', $result_user->email);
         $this->session->set_userdata('USER_PROFILE_PIC', $result_user->profile_pic);
         $this->session->set_userdata('USER_ONLINE', 'Y');
         $this->session->set_userdata('USER_LOGGED_IN', 'TRUE');
         $user_model->set_id($this->session->userdata('USER_ID'));
         $user_model->set_is_online('1');
         $user_service->update_user_online_status($user_model);
         echo 1;
     } else {
         echo 0;
     }
 }
Example #2
0
 function add_admin()
 {
     $user_model = new User_model();
     $user_service = new User_service();
     $avatar = $this->input->post('profile_pic', TRUE);
     $user_model->set_title($this->input->post('title', TRUE));
     $user_model->set_name($this->input->post('name', TRUE));
     if ($avatar == '') {
         $user_model->set_profile_pic('avatar.png');
     } else {
         $user_model->set_profile_pic($avatar);
     }
     $user_model->set_user_name($this->input->post('user_name', TRUE));
     $user_model->set_user_type($this->input->post('user_type', TRUE));
     $user_model->set_email($this->input->post('email', TRUE));
     $user_model->set_address($this->input->post('address', TRUE));
     $user_model->set_contact_no_1($this->input->post('contact_no_1', TRUE));
     $user_model->set_contact_no_2($this->input->post('contact_no_2', TRUE));
     $user_model->set_password(md5($this->input->post('password', TRUE)));
     $user_model->set_added_by($this->session->userdata('USER_ID'));
     $user_model->set_added_date(date("Y-m-d H:i:s"));
     $user_model->set_account_activation_code('code');
     $user_model->set_is_online('0');
     //        $body_type_model->set_updated_date(date("Y-m-d H:i:s"));
     //        $body_type_model->set_updated_by(1);
     $user_model->set_is_published('1');
     $user_model->set_is_deleted('0');
     echo $user_service->add_user($user_model);
 }
Example #3
0
 function reset_password()
 {
     $user_model = new User_model();
     $user_service = new User_service();
     $user_model->set_user_name($this->input->post('txtusername', TRUE));
     $user_model->set_password(md5($this->input->post('txtpassword', TRUE)));
     echo $user_service->update_password($user_model);
 }
Example #4
0
 function update_user()
 {
     $user_model = new User_model();
     $user_service = new User_service();
     $avatar = $this->input->post('profile_pic', TRUE);
     if ($avatar == '') {
         $user_model->set_profile_pic('avatar.png');
     } else {
         $user_model->set_profile_pic($avatar);
     }
     $user_model->set_id($this->session->userdata('USER_ID'));
     $user_model->set_title($this->input->post('title', TRUE));
     $user_model->set_name($this->input->post('name', TRUE));
     $user_model->set_user_name($this->input->post('user_name', TRUE));
     $user_model->set_user_type($this->input->post('user_type', TRUE));
     $user_model->set_email($this->input->post('email', TRUE));
     $user_model->set_address($this->input->post('address', TRUE));
     $user_model->set_contact_no_1($this->input->post('contact_no_1', TRUE));
     $user_model->set_contact_no_2($this->input->post('contact_no_2', TRUE));
     $user_model->set_password($this->input->post('password', TRUE));
     $user_model->set_profile_pic($this->input->post('profile_pic', TRUE));
     $user_model->set_updated_by($this->session->userdata('USER_ID'));
     $user_model->set_updated_date(date("Y-m-d H:i:s"));
     echo $user_service->update_user($user_model);
 }
Example #5
0
 function update_user()
 {
     $user_model = new User_model();
     $user_service = new User_service();
     $user_model->set_id($this->input->post('user_id', TRUE));
     $user_model->set_name($this->input->post('name', TRUE));
     $user_model->set_user_name($this->input->post('user_name', TRUE));
     $user_model->set_user_type($this->input->post('user_type', TRUE));
     $location_id = "";
     if ($this->session->userdata('USER_TYPE') != '1') {
         $location_id = $this->session->userdata('USER_LOCATION');
     } else {
         $location_id = $this->input->post('location_id', TRUE);
     }
     $user_model->set_location_id($location_id);
     $user_model->set_email($this->input->post('email', TRUE));
     $user_model->set_password(md5($this->input->post('password', TRUE)));
     $user_model->set_updated_by($this->session->userdata('USER_ID'));
     $user_model->set_updated_date(date("Y-m-d H:i:s"));
     echo $user_service->update_user($user_model);
 }