} else { echo json_encode(true); return; } } if ($check_allowed_users) { require_once 'include/functions_db.php'; $user_id = get_parameter('user_id', ''); $id_group = get_parameter('id_group', ''); if ($user_id == '') { echo json_encode(true); return; } if ($id_group != '') { $filter['group'] = $id_group; } else { $filter = false; } //~ $query_users = users_get_allowed_users_query ($config['id_user'], false); $query_users = users_get_allowed_users_query($config['id_user'], $filter); $users = get_db_all_rows_sql($query_users); foreach ($users as $user) { if (preg_match('/^' . $user_id . '$/i', $user['id_usuario']) || preg_match('/^' . $user_id . '$/i', $user['nombre_real']) || preg_match('/^' . $user_id . '$/i', $user['num_employee'])) { echo json_encode(true); return; } } // Does not exist echo json_encode(false); return; }
function users_get_users_owners_or_creators($id_user, $id_group = false) { global $config; $values = array(); if ($id_user === 0) { $id_user = $config['id_user']; } if ($id_group) { $query_users = "SELECT id_usuario FROM tusuario_perfil WHERE id_grupo = {$id_group} OR id_grupo = 0"; } else { $query_users = users_get_allowed_users_query($id_user, false); } $users = get_db_all_rows_sql($query_users); if ($users == false) { $users = array(); } foreach ($users as $user) { $values[$user['id_usuario']] = get_db_row_sql("SELECT id_usuario, nombre_real, num_employee FROM tusuario WHERE id_usuario = '" . $user['id_usuario'] . "'"); } return $values; }