mirror of
https://github.com/HaschekSolutions/pictshare.git
synced 2025-11-18 14:08:01 +00:00
added warning message if upload forbidden instead of just 401 error
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -42,6 +42,13 @@
|
||||
echo '<div class="alert alert-warning" role="alert">'.file_get_contents(ROOT.DS.'notice.txt').'</div>';
|
||||
?>
|
||||
<div class="well">
|
||||
<?php if($forbidden===true) { ?>
|
||||
|
||||
<h2>Upload forbidden</h2>
|
||||
|
||||
<p>Due to configured restrictions, you are not allowed to upload files at this time</p>
|
||||
|
||||
<?php } else { ?>
|
||||
<div id="uploadinfo"></div>
|
||||
<p>
|
||||
<?php
|
||||
@@ -54,6 +61,7 @@
|
||||
<input name="file" type="file" multiple />
|
||||
</div>
|
||||
</form>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user