<?php
// app/lib/util.php
function h($s) { return htmlspecialchars((string)$s, ENT_QUOTES, 'UTF-8'); }

function flash_set($key, $msg) { $_SESSION['flash'][$key] = $msg; }
function flash_get($key) {
    if (!isset($_SESSION['flash'][$key])) return null;
    $m = $_SESSION['flash'][$key];
    unset($_SESSION['flash'][$key]);
    return $m;
}

function redirect($url) { header('Location: ' . $url); exit; }

function now_utc() { return gmdate('Y-m-d H:i:s'); }
