STB/blog/init.php

36 lines
858 B
PHP
Raw Permalink Normal View History

2025-01-15 20:02:23 +01:00
<?php
require __DIR__ . "/autoload.php";
function e($str)
{
return htmlentities($str, ENT_QUOTES, 'UTF-8');
}
$container = new App\Core\Container();
// return GET['index'], set SESION['index'], OR return default
function getPostAndSetSession($index, $session, $default){
if ((isset($_POST[$index])) || !empty($_SESSION[$index])){
$_SESSION[$session] = $_POST[$index];
} else {
if (!isset($_SESSION[$session])){
$_SESSION[$session] = $default;
}
}
return $_SESSION[$session];
}
// return GET['index'], set SESION['index'], OR return default
function getAndSetSession($index, $session, $default){
if ((isset($_GET[$index])) || !empty($_GET[$index])){
$_SESSION[$session] = $_GET[$index];
} else {
if (!isset($_SESSION[$session])){
$_SESSION[$session] = $default;
}
}
return $_SESSION[$session];
}
?>