<?php
require_once 'shikanisha.kts.php';

if (!isset($_GET['page_id'])) {
    die(json_encode(['success' => false, 'message' => 'Page ID required']));
}

$pageId = $conn->real_escape_string($_GET['page_id']);
$query = "SELECT * FROM pages WHERE page_id = '$pageId'";
$result = $conn->query($query);

if ($result->num_rows > 0) {
    header('Content-Type: application/json');
    echo json_encode($result->fetch_assoc());
} else {
    echo json_encode(['success' => false, 'message' => 'Page not found']);
}

$conn->close();
?>