added client subnet filter

This commit is contained in:
Anton Mitsengendler
2019-02-20 17:12:06 +03:00
parent 5f5b836a22
commit 8da3573ffb
4 changed files with 34 additions and 1 deletions

View File

@@ -21,6 +21,10 @@ if(!isFolderWritable(ROOT.DS.'data'))
else if(!isFolderWritable(ROOT.DS.'tmp'))
exit(json_encode(array('status'=>'err','reason'=>'Temp directory not writable')));
// check if client has permission to upload
if(defined('ALLOWED_SUBNET') && !isIPInRange( getUserIP(), ALLOWED_SUBNET ))
exit(json_encode(array('status'=>'err','reason'=> 'Access denied')));
$hash = sanatizeString(trim($_REQUEST['hash']))?sanatizeString(trim($_REQUEST['hash'])):false;
// check for POST upload