Now, /publish/{edit,addeditor,login,logout} must be accessed via
https://; other pages should not be (but can be).
28 lines
704 B
PHP
28 lines
704 B
PHP
<?
|
|
if ( ! isset($_SERVER['HTTPS'])) {
|
|
header('Location: https://' . $_SERVER["SERVER_NAME"] . $_SERVER['REQUEST_URI']);
|
|
}
|
|
require_once("../session.lib.php");
|
|
if (isset($_SESSION['editor'])) {
|
|
if (isset($_COOKIE[session_name()])) {
|
|
setcookie(session_name(), '', time()-42000, '/');
|
|
}
|
|
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: http://xxx.org.za/");
|
|
return;
|
|
}
|
|
?>
|