<?php
// /user/_bootstrap.php
if (session_status() === PHP_SESSION_NONE) session_start();

require_once __DIR__ . '/../db.php'; // uses your existing mysqli $conn

if (!function_exists('h')) {
  function h($s){ return htmlspecialchars($s ?? '', ENT_QUOTES, 'UTF-8'); }
}

function flash($key){
  if (!empty($_SESSION[$key])) {
    $msg = $_SESSION[$key];
    unset($_SESSION[$key]);
    return '<div class="card flash" style="background:#eff6ff;border:1px solid #bfdbfe;color:#1e40af;margin:10px 0;padding:10px;border-radius:10px">'
          .h($msg).'</div>';
  }
  return '';
}
