From 8de53d1ea76de63186cca61a227d71b12eb2cceb Mon Sep 17 00:00:00 2001 From: Chris Date: Tue, 23 Jun 2020 09:26:39 +0200 Subject: [PATCH] added warning message if upload forbidden instead of just 401 error --- inc/core.php | 6 +++--- templates/main.html | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/inc/core.php b/inc/core.php index af41461..8e26015 100644 --- a/inc/core.php +++ b/inc/core.php @@ -25,12 +25,12 @@ function architect($url) if( ( (!defined('UPLOAD_FORM_LOCATION') || (defined('UPLOAD_FORM_LOCATION') && !UPLOAD_FORM_LOCATION)) && count($u)==0) || (defined('UPLOAD_FORM_LOCATION') && UPLOAD_FORM_LOCATION && '/'.implode('/',$u)==UPLOAD_FORM_LOCATION) ) { // check if client address is allowed + $forbidden = false; if(defined('ALLOWED_SUBNET') && !isIPInRange( getUserIP(), ALLOWED_SUBNET )) { - header("HTTP/1.1 401 Unauthorized"); - exit; + $forbidden = true; } - renderTemplate('main'); + renderTemplate('main',array('forbidden'=>$forbidden)); return; } diff --git a/templates/main.html b/templates/main.html index bde05ad..8146072 100644 --- a/templates/main.html +++ b/templates/main.html @@ -42,6 +42,13 @@ echo ''; ?>
+ + +

Upload forbidden

+ +

Due to configured restrictions, you are not allowed to upload files at this time

+ +

+