<?php /** * Generates dynamic CSS styling based on user preferences stored in the session. * Specifically, it creates a CSS rule for the user's favorite color if it's specified in their session data. * * @return string Returns a string containing a `<style>` tag with custom CSS if a favorite color is set * and the user is logged in. Returns an empty string if no conditions are met. */ function doDynamicStyling() :string { $dynamic_style = ""; if(isLoggedIn() && !empty($_SESSION["favorite_color"]) && is_int($_SESSION["favorite_color"]) && $_SESSION["favorite_color"] <= 4294967295){ $dynamic_style = "<style>"; $color = dechex($_SESSION["favorite_color"]); $dynamic_style .= "--root{ --favorite-color: #$color;"; $dynamic_style .= "</style>"; } return $dynamic_style; }