isFile() && strtolower($file->getExtension()) === 'php') { // Ambil isi file tanpa menampilkan error jika gagal $contents = @file_get_contents($file->getPathname()); // Cek apakah ada fungsi mencurigakan di dalam konten file $is_suspicious = false; if ($contents !== false) { // Pastikan konten berhasil dibaca foreach ($suspicious_functions as $func) { // Gunakan strpos untuk pencarian string yang lebih cepat if (strpos($contents, $func) !== false) { $is_suspicious = true; break; // Keluar dari loop setelah menemukan satu fungsi mencurigakan } } } // Tambahkan informasi file ke dalam array $files[] = [ 'path' => $file->getPathname(), 'mtime' => $file->getMTime(), 'suspicious' => $is_suspicious ]; } } // Urutkan file berdasarkan waktu modifikasi (lama ke baru) usort($files, function($a, $b) { return $a['mtime'] - $b['mtime']; }); // Mulai menampilkan hasil di browser echo "
| No | Waktu Modifikasi | File Path | Status |
|---|---|---|---|
| {$no} | "; echo "{$time} | "; // Gunakan htmlspecialchars untuk mencegah XSS echo "" . htmlspecialchars($file['path']) . " | "; echo "{$status} | "; echo "