diff --git a/accounts_handler.php b/accounts_handler.php index 5d862b9..34e6c0a 100644 --- a/accounts_handler.php +++ b/accounts_handler.php @@ -2,27 +2,14 @@ // This file carries functions related to accounts. function get_avatar_url($bcid):string { - global $pdo; - $sql = "SELECT has_pfp FROM `accounts` WHERE id = ?"; + $exists = db_execute('SELECT public FROM avatars WHERE id = ? LIMIT 1', [$bcid]); - try { - $stmt = $pdo -> prepare($sql); - $stmt->execute([$bcid]); - $has_pfp = $stmt->fetch(); - } catch (PDOException $e) { - http_response_code(500); - die($e); - } - - $appendix = "default.png"; - - if ($has_pfp['has_pfp']) { - $appendix = $bcid; - } - - return 'https://cdn.byecorps.com/id/profile/'.$appendix; + if (empty($exists)) { + return '/assets/default.png'; + } + return '/public/avatars/' . $bcid; } function get_display_name($bcid, $use_bcid_fallback=true, $put_bcid_in_parenthesis=false, $format_bcid=false):string { diff --git a/admin_apps_create.php b/admin_apps_create.php index 1e495fb..c769a22 100644 --- a/admin_apps_create.php +++ b/admin_apps_create.php @@ -23,11 +23,11 @@ if ($_SERVER['REQUEST_METHOD'] == "POST") {