From 97cb45922441379828a9ebea0bafb0f8a657ea8a Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Sat, 16 Sep 2017 16:06:36 +0200 Subject: [PATCH] page: .private to restrict access to subdirectories --- 403.html | 3 +++ page.php | 11 +++++++++++ 2 files changed, 14 insertions(+) create mode 100644 403.html diff --git a/403.html b/403.html new file mode 100644 index 0000000..ffac19e --- /dev/null +++ b/403.html @@ -0,0 +1,3 @@ +

Verboden toegang

+ +

Dit deel van de website is alleen zichtbaar voor leden.

diff --git a/page.php b/page.php index e8023ff..730f015 100644 --- a/page.php +++ b/page.php @@ -39,6 +39,17 @@ $Args = ''; $Page = preg_replace('/\?.*/', '', $_SERVER['REQUEST_URI']); $Page = urldecode(trim($Page, '/')) ?: 'index'; while (TRUE) { + if (file_exists("$Page/.private")) { + # access restriction + if (!isset($User)) { + http_response_code(403); + include_once 'page.inc.php'; + ob_start(); + require_once './403.html'; + exit; + } + } + if (file_exists("$Page.php")) { break; } -- 2.30.0