From: Mischa POSLAWSKY Date: Sat, 16 Sep 2017 14:06:36 +0000 (+0200) Subject: page: .private to restrict access to subdirectories X-Git-Tag: v2.2~7 X-Git-Url: http://git.shiar.nl/minimedit.git/commitdiff_plain/97cb45922441379828a9ebea0bafb0f8a657ea8a page: .private to restrict access to subdirectories --- 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; }