Edit file File name : manifest.php Content :<?php require 'db_config.php'; header('Content-Type: application/json'); // --- Helper Function --- function hslToHex($hsl_string) { if (empty($hsl_string)) return '#6d28d9'; // Default purple list($h, $s, $l) = sscanf($hsl_string, "%d %d%% %d%%"); $s /= 100; $l /= 100; $c = (1 - abs(2 * $l - 1)) * $s; $x = $c * (1 - abs(fmod($h / 60, 2) - 1)); $m = $l - $c / 2; $r = $g = $b = 0; if (0 <= $h && $h < 60) { $r = $c; $g = $x; $b = 0; } elseif (60 <= $h && $h < 120) { $r = $x; $g = $c; $b = 0; } elseif (120 <= $h && $h < 180) { $r = 0; $g = $c; $b = $x; } elseif (180 <= $h && $h < 240) { $r = 0; $g = $x; $b = $c; } elseif (240 <= $h && $h < 300) { $r = $x; $g = 0; $b = $c; } elseif (300 <= $h && $h < 360) { $r = $c; $g = 0; $b = $x; } $r = round(($r + $m) * 255); $g = round(($g + $m) * 255); $b = round(($b + $m) * 255); return sprintf("#%02x%02x%02x", $r, $g, $b); } $name = 'Omni Rewards'; $short_name = 'OmniRewards'; $icon_url = ''; $theme_color = '#6d28d9'; // Default purple try { $conn = new mysqli($servername, $username, $password, $dbname); if (!$conn->connect_error) { $result = $conn->query("SELECT businessName, logoUrl, primaryColor FROM business_settings LIMIT 1"); if ($result && $result->num_rows > 0) { $settings = $result->fetch_assoc(); $name = $settings['businessName'] ?: $name; $short_name = preg_replace('/\s+/', '', $name); if (!empty($settings['logoUrl'])) { // Construct the full URL path correctly, including subdirectories $protocol = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http"); $host = $_SERVER['HTTP_HOST']; $base_path = rtrim(dirname($_SERVER['PHP_SELF']), '/\\'); $icon_url = $protocol . "://" . $host . $base_path . "/" . $settings['logoUrl']; } if (!empty($settings['primaryColor'])) { $theme_color = hslToHex($settings['primaryColor']); } } $conn->close(); } } catch (Exception $e) { // Silently fail, defaults will be used } $icons = []; if (!empty($icon_url)) { $icons = [ [ 'src' => $icon_url, 'sizes' => '192x192', 'type' => 'image/png', 'purpose' => 'any maskable' ], [ 'src' => $icon_url, 'sizes' => '512x512', 'type' => 'image/png', 'purpose' => 'any maskable' ] ]; } $manifest = [ 'name' => $name, 'short_name' => $short_name, 'start_url' => '.', 'display' => 'standalone', 'background_color' => '#f9fafb', 'theme_color' => $theme_color, 'description' => 'A loyalty rewards application.', 'icons' => $icons ]; echo json_encode($manifest); ?> Save