Skip to content

Instantly share code, notes, and snippets.

<?php
function redirect($url, $status = 302) {
if (session_id() !== '') {
session_write_close();
}
header("Location: ".$url, true, $status);
exit;
}
<?php
// http://www.php.de/830653-post27.html
function escHTML ($s) {
return htmlspecialchars(
$s,
ENT_QUOTES | ENT_HTML5 | ENT_DISALLOWED | ENT_SUBSTITUTE,
'UTF-8'
);