"/raindrops", "cb" => "/cloudburst", "minty" => "/cloudy" ]; foreach ($members as $member) { for ($i = 1; $i < strlen($member["name"]); $i++) { $part = substr($member["name"], 0, $i); if (in_array($part, array_keys($list))) { $list[$part] = false; } else { $list[$part] = "/" . $member["name"]; } } foreach ($member["proxy_tags"] as $proxy) { $system = $member["_system"] === "gdapd" ? "rd" : "cb"; $list[$system . preg_replace("/[^a-z]/m", "", $proxy["prefix"])] = "/" . $member["name"]; } $list[$member["id"]] = "/" . $member["name"]; $list[$member["uuid"]] = "/" . $member["name"]; } $list["minty"] = "/cloudy"; if (in_array($toplevel, array_keys($list)) && $list[$toplevel]) { if ($toplevel !== "unknown") { header("Location: " . $list[$toplevel]); } else { header("Location: /?error=Page not found: " . strip_tags($toplevel)) and die(); } } else { header("Location: /?error=Page not found: " . strip_tags($toplevel)) and die(); }