Mine
public text v1 · immutable<?php
if (!isset($_SESSION['log_out_user']))
{
unset($_SERVER['AUTH_USER']);
$_SESSION['log_out_user'] = TRUE;
}
if(!isset($_SERVER['AUTH_USER']))
{
header('WWW-Authenticate: Basic realm="' . your_auth_realm_here . '"');
header('HTTP/1.0 401 Unauthorized');
echo('This is for authorized users only.');
exit;
} else {
unset($_SESSION);
header('Location: ' . $somewhere_else);
exit;
}
?>