userid($username); $isPrivateAllowed = ($username === $curuser['userid'] || $curuser['userid'] === 'zarel'); if ($isPrivate && !$isPrivateAllowed) { die('"ERROR: access denied"'); } $page = intval($_REQUEST['page'] ?? 0); $replays = null; if ($page > 25) { die('"ERROR: page limit is 25"'); } else if ($username || $format) { $replays = $Replays->search([ "username" => $username, "username2" => $username2, "format" => $format, "byRating" => $byRating, "isPrivate" => $isPrivate, "page" => $page ]); } else if ($contains) { $replays = $Replays->fullSearch($contains, $page); } else { $replays = $Replays->recent(); } if ($replays) { foreach ($replays as &$replay) { if ($replay['password'] ?? null) { $replay['id'] .= '-' . $replay['password']; } unset($replay['password']); } } echo json_encode($replays);