<?php @set_time_limit (0); $total = 0; $file1 = "log.txt"; $f1 = fopen($file1,'r'); $str_array = array(); $tokens = "|"; while($str=fgets($f1,1024)) { $tokenized = strtok($str, $tokens); $tokenized = strtok($tokens); $str_array[] = trim($tokenized); } $str_array = array_unique($str_array); echo "<pre>"; foreach ($str_array as $item) { echo scan($item) . " " . $item . "\r\n"; $total++; } echo "</pre>"; echo "Total: " . $total; function scan ($hs) { $port = 445; $time_conn = 2; $connect = @fsockopen ($hs, $port, $errno, $errstr, $time_conn); if ($connect == TRUE) { return "<font color='green'>[valid]</font>"; } else if ($connect == 0) { return "<font color='red'>[invalid]</font>"; } } ?>