Files
xxx/publish/logout.php
T

32 lines
906 B
PHP

<?
//include_once('../session.lib.php');
header( 'Cache-Control: no-store, no-cache, must-revalidate' );
header( 'Cache-Control: post-check=0, pre-check=0', false );
header( 'Pragma: no-cache' );
include_once('../session.lib.php');
if ( ! isset($_SERVER['HTTPS'])) {
header('Location: https://' . $_SERVER["SERVER_NAME"] . $_SERVER['REQUEST_URI']);
}
if (isset($_SESSION['editor'])) {
if (isset($_COOKIE[session_name()])) {
setcookie(session_name(), '', strtotime('-1 day'), '/');
}
session_destroy();
}
delete_persistent_login();
if (isset($_SESSION['referrer'])) {
$url = $_SERVER['HTTPS'] ? "https://" : "http://";
$url .= $_SERVER['HTTP_HOST'];
$url .= $_SESSION['referrer'];
unset($_SESSION['referrer']);
if (preg_match("/logout(\.php)?$/i", $url)) {
$url = "/";
}
header("Location: $url");
return;
} else {
header("Location: https://xxx.org.za/");
return;
}
?>