<?php global $DB, $RQ, $USER, $CONFIG; require_once '../../../inc/bootstrap.inc'; if ($RQ['user']['id']) { if (check_user_id($RQ['user']['id'])) { if (!is_array(fetch_user_by_id($id = intval($RQ['user']['id'])))) { if (($len = mb_strlen($RQ['user']['nick'])) >= $CONFIG['LIMITS']['NICK_LENGTH']['MIN']) { if ($len <= $CONFIG['LIMITS']['NICK_LENGTH']['MAX']) { if (!is_array(fetch_user_by_nick($RQ['user']['nick']))) { if (preg_match('/[\\da-f]{40}/', $RQ['user']['password'])) { if (!is_array($USER) or !$USER['flags']['super'] and !$USER['flags']['dispatcher']) { require_once '../../../inc/challenge.inc.php'; challenge_first($CONFIG['REGISTER']['CHALLENGE']); } $user = array('id' => $id, 'nick' => $RQ['user']['nick'], 'password' => $RQ['user']['password'], 'fullname_published' => $RQ['user']['fullname_published'] ? true : false, 'email_published' => $RQ['user']['email_published'] ? true : false); fill_if_nonempty($user, $RQ['user'], 'fullname'); fill_if_nonempty($user, $RQ['user'], 'email'); if ($CONFIG['REGISTER']['DEFAULT_BLOCKED']) { $user['flags']['blocked'] = true; } if ($RQ['user']['flags'] and $USER['flags']['super']) { $user['flags'] = $RQ['user']['flags']; } if (is_array($RQ['user']['car']) and car_model_exists($RQ['user']['car']['model']) and car_color_exists($RQ['user']['car']['model']) and check_car_number($RQ['user']['car']['number'])) { $user['car'] = array('model' => $RQ['user']['car']['model'], 'color' => $RQ['user']['car']['color'], 'number' => $RQ['user']['car']['number']); if ($RQ['user']['driving']) { $user['driving'] = true; } } update_user($user);
} $key = $_GET['key']; if ($key == $api_key) { $task = $_GET['task']; if ($task == 'account') { $user_id = $_GET['user_id']; if (check_user_id($user_id) == 0) { //no user echo json_encode(array('error' => 'no_such_user')); exit; } $password = get_password($user_id); $json = array('password' => $password); echo json_encode($json); } else { if ($task == 'submit_problems') { $user_id = $_GET['user_id']; if (check_user_id($user_id) == 0) { //no user echo json_encode(array('error' => 'no_such_user')); exit; } $submit_problems = get_submit_problems($user_id); echo json_encode(array('submit_problems' => $submit_problems)); } else { echo json_encode(array('error' => 'no_such_task')); } } } else { echo json_encode(array('error' => 'Go away.')); }
function group_user_remove($group_id, $user_id) { global $_CLASS; $group_id = is_array($group_id) ? $group_id : array($group_id); $user_id = is_array($user_id) ? $user_id : array($user_id); $group_id = array_unique(array_map('intval', array_filter($group_id, 'array_filter_int'))); if (empty($group_id)) { return; } if (check_user_id($user_id) === false) { return; } $sql = 'SELECT user_id FROM ' . CORE_USERS_TABLE . ' WHERE user_group IN (' . implode(', ', $group_id) . ') AND user_id IN (' . implode(', ', $user_id) . ')'; $result = $_CLASS['core_db']->query($sql); $defaults = array(); while ($row = $_CLASS['core_db']->fetch_row_assoc($result)) { $defaults[] = $row['user_id']; } $_CLASS['core_db']->free_result($result); // We move all users that are removed from the default groups to // REGISTERED / REGISTERED_COPPA if (!empty($defaults)) { // need to update/completion $result = $_CLASS['core_db']->query('SELECT * FROM ' . GROUPS_TABLE . ' WHERE group_id = 4'); $row = $_CLASS['core_db']->fetch_row_assoc($result); $_CLASS['core_db']->free_result($result); $sql = 'UPDATE FROM ' . CORE_USERS_TABLE . ' SET user_group = 4, user_rank = -1 WHERE user_id IN (' . implode(', ', $group_id) . ')'; $result = $_CLASS['core_db']->query($sql); } $sql = 'DELETE FROM ' . CORE_GROUPS_MEMBERS_TABLE . ' WHERE group_id IN (' . implode(', ', $group_id) . ') AND user_id IN (' . implode(', ', $user_id) . ')'; $_CLASS['core_db']->query($sql); }
if ($game == "") { exit; } if (port_exists($dedi_ip, $port)) { $msg = _gameserver_port_in_use; $error = true; } if (check_dedi_id($dedicated)) { $msg = _gameserver_dedi_id_invalid; $error = true; } if (check_template($game)) { $msg = _message_template_error; $error = true; } if (check_user_id($user_gs)) { $msg = _gameserver_user_invalid; $error = true; } $installed = check_game_installed($dedicated, $game); if ($installed[0] != 1) { $error = true; $msg = $installed[1]; } if ($error == false) { $i = 1; if ($mass == 0) { $mass_ammount = 1; } while ($i <= $mass_ammount) { $stmt = $mysqli->prepare("SELECT name,u_count FROM users WHERE id = ?");