Repositories | Polyback | Log in to see private repositories
756 bytes | parent directory
<?php require $_SERVER["DOCUMENT_ROOT"]."/api/private/core.php";
use pizzaboxer\ProjectPolygon\Users;
use pizzaboxer\ProjectPolygon\Thumbnails;
header("Pragma: no-cache");
header("Cache-Control: no-cache");
// old places ask with any capitalisation (Thumbs/Avatar.ashx?userid=1)
$Query = array_change_key_case($_GET, CASE_LOWER);
$UserID = $Query['id'] ?? $Query['userid'] ?? 0;
$Username = $Query['username'] ?? "";
if (strlen($Username)) $UserID = Users::GetIDFromName($Username);
if (!is_numeric($UserID)) die(http_response_code(404));
// games show players' pictures (the engine has no site session, like the old client)
$FromGame = str_starts_with(GetUserAgent(), "polygon-engine/");
redirect(Thumbnails::GetAvatar($UserID, 420, 420, $FromGame));