<?php
// === PROTECTION JSON - NE PAS SUPPRIMER ===
error_reporting(0);
ini_set('display_errors', 0);
ob_start();
// === FIN PROTECTION ===


/**
 * API : Renouveler la session
 * Fichier : api/renew_session.php
 */

require_once '../config/session.php';

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

if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
    http_response_code(405);
    echo json_encode(['success' => false, 'error' => 'Method not allowed']);
    exit();
}

$success = SessionManager::renewSession();

echo json_encode([
    'success' => $success,
    'time_remaining' => SessionManager::getTimeRemaining()
]);
