public function password() { $this->data['title'] = 'Change Password'; $user_model = new \models\user(); $user_id = \helpers\session::get('user')->user_id; $user_details = $user_model->get(array('user_id' => $user_id, 'user_password' => md5($_POST['old_password']))); if (isset($_POST['password1']) && !empty($_POST['password1'])) { if (count($user_details) > 0) { if ($_POST['password1'] == $_POST['password2']) { //update user db $update_array = array('user_password' => md5($_POST['password1'])); $update_array = \helpers\gump::xss_clean($update_array); $update_array = \helpers\gump::sanitize($update_array); $update_id = $user_model->updateId($update_array, $user_id); if ($update_id > 0) { $this->data['success'] = 'Password Changed'; } else { $this->data['error'] = 'Operation Fails!'; } } else { $this->data['error'] = 'Incorrect match, password change fails!'; } } else { $this->data['error'] = 'Incorrect match, password change fails!'; } } View::rendertemplate('header', $this->data); View::render('user/user.password', $this->data); View::rendertemplate('footer', $this->data); }