<?php
require_once($_SERVER['DOCUMENT_ROOT'] . "/session.php");
require_once($_SERVER['DOCUMENT_ROOT'] . "/lib/mydb.php");

header('Content-Type: application/json');

try {
    $pdo = db_connect();
    
    // 제품모델 목록 가져오기
    $sql = "SELECT DISTINCT model_name FROM bottombar WHERE model_name IS NOT NULL AND model_name <> '' ORDER BY model_name ASC";
    $stmh = $pdo->prepare($sql);
    $stmh->execute();
    $models = $stmh->fetchAll(PDO::FETCH_COLUMN);
    
    echo json_encode([
        'success' => true,
        'models' => $models
    ]);
    
} catch (PDOException $e) {
    echo json_encode([
        'success' => false,
        'error' => $e->getMessage()
    ]);
}
?> 