0 && time() > $expiryTs) { require_once __DIR__ . '/api/_helpers.php'; // Delete expired URL [$fp, $urls] = read_json_locked(__DIR__ . '/data/urls.json'); if (isset($urls[$code])) { unset($urls[$code]); write_json_locked($fp, $urls); } http_response_code(410); echo 'Gone'; exit; } // Verify HMAC signature if present (detect server-side tampering) if (is_string($signature) && $signature !== '') { require_once __DIR__ . '/api/_helpers.php'; $expected_sig = hash_hmac('sha256', $hash, get_hmac_secret()); if (!hash_equals($expected_sig, $signature)) { // Signature mismatch — possible tampering, log and proceed (graceful degradation) error_log("xmrpay: Signature mismatch for code $code"); } } $host = isset($_SERVER['HTTP_HOST']) && is_string($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : 'xmrpay.link'; $base = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https' : 'http') . '://' . $host; header('Location: ' . $base . '/#' . $hash . '&c=' . $code, true, 302); exit;