<?php
session_start();
header('Content-Type: application/json; charset=utf-8');

$response = [];

if (isset($_SESSION['galoneraCodigo'])) {
    // Clave principal que usaremos en el JS: "galonera"
    $response['galonera'] = $_SESSION['galoneraCodigo'];
} elseif (isset($_SESSION['galonera'])) {
    $response['galonera'] = $_SESSION['galonera'];
} elseif (isset($_SESSION['codigo_galonera'])) {
    $response['galonera'] = $_SESSION['codigo_galonera'];
} else {
    $response['error'] = "No existe un dato en la sesión [galoneraCodigo]";
}

echo json_encode($response, JSON_UNESCAPED_UNICODE);
