<?php
header('Access-Control-Allow-Origin: *');
header('Content-Type: application/json');

require 'db.php';

try {
    $stmt = $conn->query("SELECT * FROM settings LIMIT 1");
    $settings = $stmt->fetch(PDO::FETCH_ASSOC);
file_put_contents("lelek.txt",json_encode($settings));
    echo json_encode([
        'status' => 'success',
        'data' => $settings
    ]);
} catch (PDOException $e) {
    echo json_encode([
        'status' => 'error',
        'message' => 'Query failed: ' . $e->getMessage()
    ]);
}
?>
