diff --git a/index.php b/index.php index 12bf4da..8471e9b 100644 --- a/index.php +++ b/index.php @@ -26,12 +26,12 @@ if($PASSWORD) { session_start(); if(!$_SESSION['_sfm_allowed']) { // sha1, and random bytes to thwart timing attacks. Not meant as secure hashing. - $t = bin2hex(openssl_random_pseudo_bytes(10)); + $t = bin2hex(openssl_random_pseudo_bytes(10)); if($_POST['p'] && sha1($t.$_POST['p']) === sha1($t.$PASSWORD)) { $_SESSION['_sfm_allowed'] = true; header('Location: ?'); } - echo '
'; + echo ''; exit; } } @@ -47,7 +47,7 @@ if($tmp === false) err(404,'File or Directory Not Found'); if(substr($tmp, 0,strlen($tmp_dir)) !== $tmp_dir) err(403,"Forbidden"); -if(strpos($_REQUEST['file'], DIRECTORY_SEPARATOR) === 0) +if(strpos($_REQUEST['file'], DIRECTORY_SEPARATOR) === 0) err(403,"Forbidden"); @@ -103,8 +103,8 @@ if($_GET['do'] == 'list') { var_dump($_POST); var_dump($_FILES); var_dump($_FILES['file_data']['tmp_name']); - foreach($disallowed_extensions as $ext) - if(preg_match(sprintf('/\.%s$/',preg_quote($ext)), $_FILES['file_data']['name'])) + foreach($disallowed_extensions as $ext) + if(preg_match(sprintf('/\.%s$/',preg_quote($ext)), $_FILES['file_data']['name'])) err(403,"Files of this type are not allowed."); var_dump(move_uploaded_file($_FILES['file_data']['tmp_name'], $file.'/'.$_FILES['file_data']['name'])); @@ -132,7 +132,7 @@ function rmrf($dir) { function is_recursively_deleteable($d) { $stack = [$d]; while($dir = array_pop($stack)) { - if(!is_readable($dir) || !is_writable($dir)) + if(!is_readable($dir) || !is_writable($dir)) return false; $files = array_diff(scandir($dir), ['.','..']); foreach($files as $file) if(is_dir($file)) { @@ -177,7 +177,7 @@ $MAX_UPLOAD_SIZE = min(asBytes(ini_get('post_max_size')), asBytes(ini_get('uploa