<?php
$bannerFiles = glob("banners/*.{jpg,jpeg,png}", GLOB_BRACE);
?>

<!DOCTYPE html>
<html lang="pt-BR">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Exibição de Banners</title>
    <style>
        body { font-family: Arial, sans-serif; text-align: center; background-color: #f4f4f4; }
        img { width: 80%; max-width: 800px; border-radius: 10px; }
    </style>
    <script>
        let banners = <?php echo json_encode($bannerFiles); ?>;
        let currentIndex = 0;

        function showBanner() {
            if (banners.length > 0) {
                document.getElementById("banner").src = banners[currentIndex];
                currentIndex = (currentIndex + 1) % banners.length;
            }
        }

        setInterval(showBanner, 5000); // Troca a cada 5 segundos
    </script>
</head>
<body onload="showBanner()">
    <h1>Exibição de Banners</h1>
    <img id="banner" src="" alt="Banner">
</body>
</html>
