Exemple #1
0
 /**
  * Submission of Account Update form
  */
 public function update_account()
 {
     $form_url = 'account';
     if (validate_form($form_url)) {
         // update db
         $data = elements(['full_name'], $this->input->post());
         $result = $this->backend_users->update($this->mUser['id'], $data);
         if ($result) {
             // update session user data
             refresh_user($data);
             set_alert('success', 'Info du compte mis à jour avec succés.');
         } else {
             // unknown database error
             set_alert('danger', 'Échec de la mise à jour.');
         }
     }
     // back to form
     redirect($form_url);
 }
Exemple #2
0
 /**
  * Submission of Account Update form
  */
 public function update_account()
 {
     $form_url = 'account';
     if (validate_form($form_url)) {
         // update db
         $data = elements(array('full_name'), $this->input->post());
         $result = $this->backend_users->update($this->mUser['id'], $data);
         if ($result) {
             // update session user data
             refresh_user($data);
             set_alert('success', 'Account info updated.');
         } else {
             // unknown database error
             set_alert('danger', 'Update failed.');
         }
     }
     // back to form
     redirect($form_url);
 }
Exemple #3
0
 public function update_info()
 {
     if (validate_form('account')) {
         // check POST data
         $update_data = elements(array('first_name', 'last_name', 'email'), $this->input->post());
         // check if email is unique (except the login user him/herself)
         $user = $this->users->get_by(array('email' => $update_data['email']));
         if (!empty($user) && $user['id'] != $this->mUser['id']) {
             set_alert('danger', 'The Email is taken by another user.');
             redirect('account');
             exit;
         }
         // confirm to update account info
         $success = $this->users->update($this->mUser['id'], $update_data);
         if ($success) {
             set_alert('success', 'Successfully updated.');
             refresh_user($update_data);
         } else {
             set_alert('danger', 'Database error.');
         }
     }
     redirect('account');
 }
                            }
                        } else {
                            if ($valid === '0') {
                                $token = null;
                            }
                        }
                    }
                    if (isset($_GET['update'])) {
                        $gid = (int) $_GET['group_id'];
                        $sids = $mysqli->real_escape_string($_GET['secondary_ids']);
                        $banned = (int) isset($_GET['banned']);
                        $res = $mysqli->query("UPDATE xf_user SET user_group_id = {$gid}, " . "secondary_group_ids = '{$sids}', is_banned = {$banned} " . "WHERE user_id = {$user_id}");
                        if (!$res) {
                            $error = $mysqli->error;
                        } else {
                            refresh_user($discord_id);
                            $group_id = $gid;
                            $secondary_ids = $_GET['secondary_ids'];
                            $is_banned = $banned;
                        }
                    }
                }
            }
        }
    } else {
        $logged_id = false;
    }
}
$mysqli->close();
?>
<!DOCTYPE html>