files: Fix authentication on upload
This commit is contained in:
@ -8,6 +8,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'PUT') {
|
||||
$name = substr($_SERVER['PATH_INFO'], 1);
|
||||
if (str_contains($name, "..") || str_contains($name, "/")) {
|
||||
header('Status: 403');
|
||||
header('Content-Type: text/plain');
|
||||
header('Content-Length: 17');
|
||||
exit("403 Forbidden :(\n");
|
||||
}
|
||||
|
||||
@ -17,11 +19,16 @@ if ($_SERVER['REQUEST_METHOD'] === 'PUT') {
|
||||
fclose($fp);
|
||||
fclose($upload);
|
||||
|
||||
header('Status: 200');
|
||||
header('Content-Type: text/plain');
|
||||
header('Content-Length: 10');
|
||||
exit("200 OK :)\n");
|
||||
} else if ($_SERVER['REQUEST_METHOD'] !== 'GET' && $_SERVER['REQUEST_METHOD'] !== 'HEAD') {
|
||||
header('Status: 405');
|
||||
header('Content-Length: 0');
|
||||
exit();
|
||||
header('Allow: GET, HEAD, PUT');
|
||||
header('Content-Type: text/plain');
|
||||
header('Content-Length: 26');
|
||||
exit("405 Method Not Allowed :(\n");
|
||||
}
|
||||
|
||||
global $getProd;
|
||||
|
Reference in New Issue
Block a user