<?php
require_once 'config.php';
header('Content-Type: application/json');

try {
    global $pdo;
    $stmt = $pdo->query("SELECT * FROM banners WHERE is_active = 1 ORDER BY display_order ASC LIMIT 5");
    $banners = $stmt->fetchAll();
    echo json_encode(['success' => true, 'data' => $banners]);
} catch (Throwable $e) {
    echo json_encode(['success' => false, 'message' => $e->getMessage()]);
}
?>