prepare("SELECT id, prenom, nom FROM praticien WHERE id = ? LIMIT 1"); $stmt->execute([$currentPraticienId]); if ($row = $stmt->fetch(PDO::FETCH_ASSOC)) { $p = trim((string)($row['prenom'] ?? '')); $n = trim((string)($row['nom'] ?? '')); $pid = trim((string)($row['id'] ?? '')); $currentPraticienName = trim($p.' '.$n); } } // ===================================================== // [Liste Praticien avec autorisations] // ===================================================== $pid = (int)$currentPraticienId; $permRow = null; if ($pid && $sec_uid) { $q = $pdo->prepare(" SELECT sp.can_manage_rdv, sp.can_edit_slots FROM secretaire_praticien sp WHERE sp.secretaire_user_id = :u AND sp.praticien_id = :pid AND sp.is_active = 1 LIMIT 1 "); $q->execute(['u' => $sec_uid, 'pid' => $pid]); $permRow = $q->fetch(PDO::FETCH_ASSOC) ?: null; } // ===================================================== // [RETOUR / REFERER SÉCURISÉ] // ===================================================== $ref = $_SERVER['HTTP_REFERER'] ?? ''; $host = $_SERVER['HTTP_HOST'] ?? ''; $safeRef = ''; if ($ref) { $u = parse_url($ref); if (!empty($u['host']) && $u['host'] === $host) $safeRef = $ref; } $fallbackBack = $safeRef ?: '/public/cabinet/dashboard.php'; // ===================================================== // [DETECTION MOBILE] // ===================================================== $is_mobile = preg_match('/Mobile|Android|iPhone|iPad/i', $_SERVER['HTTP_USER_AGENT'] ?? ''); ?>