prepare("SELECT id FROM users WHERE username = ?"); $stmt->execute([$username]); if ($stmt->rowCount() == 0) { $stmt = $db->prepare("UPDATE users SET username = ? WHERE id = ?"); $stmt->execute([$username, $_SESSION["user_id"]]); } else { generate_alert("/account", "The username has already taken"); exit; } } if (isset($_FILES["pfp"]) && !empty($_FILES["pfp"]["tmp_name"])) { $pfp = $_FILES["pfp"]; if (!is_dir("../static/userdata/avatars")) { mkdir("../static/userdata/avatars", 0777, true); } if ( $err = resize_image( $pfp["tmp_name"], $_SERVER["DOCUMENT_ROOT"] . "/static/userdata/avatars/" . $_SESSION["user_id"], ACCOUNT_PFP_MAX_SIZE[0], ACCOUNT_PFP_MAX_SIZE[1], false, true ) ) { generate_alert("/account", sprintf("Error occurred while processing the profile picture (%d)", $err)); exit; } } if (isset($_FILES["banner"]) && !empty($_FILES["banner"]["tmp_name"])) { $banner = $_FILES["banner"]; if (!is_dir("../static/userdata/banners")) { mkdir("../static/userdata/banners", 0777, true); } if ( $err = resize_image( $banner["tmp_name"], $_SERVER["DOCUMENT_ROOT"] . "/static/userdata/banners/" . $_SESSION["user_id"], ACCOUNT_BANNER_MAX_SIZE[0], ACCOUNT_BANNER_MAX_SIZE[1], false, true ) ) { generate_alert("/account", sprintf("Error occurred while processing the profile banner (%d)", $err)); exit; } } $db = null; generate_alert("/account", "Your changes have been applied!", 200); exit; } ?> Account management - <?php echo INSTANCE_NAME ?>

Account management

Profile

Profile picture

'; } else { echo "

You don't have profile picture

"; } ?>

Profile banner

'; } else { echo "

You don't have profile banner

"; } ?>

Username

">

Connections

prepare("SELECT * FROM connections WHERE user_id = ?"); $stmt->execute([$_SESSION["user_id"]]); $connections = $stmt->fetchAll(); $platforms = ["twitch"]; foreach ($platforms as $platform) { $connection = null; $key = array_search($platform, array_column($connections, "platform")); if (!is_bool($key)) { $connection = $connections[$key]; } echo "
"; echo "
"; echo "
"; echo "" . ucfirst($platform) . ""; // TODO: check if connection is still alive if ($connection == null) { echo "Not connected"; } else { echo "" . $connection["alias_id"] . ""; } echo "
"; echo "
"; if ($connection == null) { echo ""; echo 'Connect'; echo ""; } else { echo ""; echo 'Disconnect'; echo ""; } echo "
"; } ?>

Security & Privacy

prepare("SELECT CASE WHEN password IS NOT NULL THEN 1 ELSE 0 END as set_password FROM users WHERE id = ?"); $stmt->execute([$_SESSION["user_id"]]); $set_password = $stmt->fetch()[0]; if ($set_password): ?>
prepare("SELECT hide_actions FROM user_preferences WHERE id = ?"); $stmt->execute([$_SESSION["user_id"]]); if (intval($stmt->fetch()[0]) == 1) { echo 'checked'; } ?>>