prepare(" SELECT rv.id, rv.praticien_id, rv.client_id, rv.date_rdv FROM rendez_vous rv WHERE rv.id = ? LIMIT 1 "); $stmt->execute([$rdv_id]); $rdv = $stmt->fetch(PDO::FETCH_ASSOC); if (!$rdv) { http_response_code(404); exit('Rendez-vous introuvable.'); } // Rôle & appartenance $role = $_SESSION['role'] ?? ''; $refId = (int)($_SESSION['reference_id'] ?? 0); $ok = ($role === 'praticien' && $refId === (int)$rdv['praticien_id']) || ($role === 'client' && $refId === (int)$rdv['client_id']); if (!$ok) { http_response_code(403); exit('Accès refusé.'); } // Fenêtre d’accès temporelle (si ta BDD est en UTC, décommente la conversion) // $start = (new DateTime($rdv['date_rdv'], new DateTimeZone('UTC')))->setTimezone($tz); $start = new DateTime($rdv['date_rdv'], $tz); $open = (clone $start)->modify('-' . (int)$config['open_before_minutes'] . ' minutes'); $close = (clone $start)->modify('+' . (int)$config['close_after_minutes'] . ' minutes'); $now = new DateTime('now', $tz); if ($now < $open) { http_response_code(403); exit('La salle ouvre à '.$open->format('H:i').'.'); } if ($now > $close){ http_response_code(403); exit('La salle a fermé à '.$close->format('H:i').'.'); } // Création/obtention de salle require_once __DIR__ . '/visio_create_or_get.php'; $allowCreate = ($role === 'praticien' && isset($_GET['start']) && $_GET['start'] == '1'); $roomSlug = visio_room_for_rdv($pdo, $rdv_id, $config['slug_secret'], $allowCreate); if (!$roomSlug) { // Pas de salle -> on affiche un message UX propre + code HTTP 403 header('Content-Type: text/html; charset=UTF-8', true, 403); echo << Ваша консультация скоро начнётся
Ожидание подключения

Ваша консультация скоро начнётся

Пожалуйста, оставайтесь на этой странице — специалист подключится в ближайшее время. Если окно не открылось автоматически, нажмите «Обновить».

Мои консультации

Подсказка: проверьте доступ к камере и микрофону заранее.

HTML; exit; } // Nom affiché //$displayName = htmlspecialchars($_SESSION['display_name'] ?? ($role === 'praticien' ? 'Praticien' : 'Client')); //$jitsiDomain = $config['jitsi_domain']; require_once __DIR__ . '/nom_afficher.php'; ?> Visio — RDV #<?= (int)$rdv_id ?>