<?php
header('Content-Type: application/json; charset=utf-8'); // Set content type to UTF-8
include('../connection.php'); // Include database connection

// Ensure the connection is using UTF-8
$conn->set_charset("utf8mb4"); // Use utf8mb4 for better compatibility with emojis and characters

// Prepare the SQL statement to get user data by ID
$stmt = $conn->prepare("SELECT * FROM setting WHERE id = 1 LIMIT 1");
$stmt->execute();
$result = $stmt->get_result();

if ($row = $result->fetch_assoc()) {
    $data = [
        'id' => $row['id'],
        'notice' => $row['notice'],
        'version' => $row['version'],
        'url_lineman' => $row['url_lineman']
    ];
} else {
    // User not found, prepare error data
    $data = [
        'status' => 'error',
        'message' => 'ত্রুটি ঘটেছে!' // Error message in Bangla
    ];
}

$jsonData = json_encode($data, JSON_UNESCAPED_UNICODE); // Ensure JSON encodes Bangla correctly
echo $jsonData;

// Close the statement
$stmt->close();
?>
