<?php
// get_banners.php - Endpoint simplificado para banners
header('Content-Type: application/json');
header('Access-Control-Allow-Origin: *');

$database = 'ads.db';

try {
    $adb = new SQLite3($database);
    
    // Buscar anúncios
    $query = "SELECT * FROM ads ORDER BY id DESC";
    $result = $adb->query($query);
    
    $banners = [];
    while ($row = $result->fetchArray(SQLITE3_ASSOC)) {
        $banners[] = $row['url'];
    }
    
    echo json_encode($banners);
    
} catch (Exception $e) {
    echo json_encode([]);
}
?>