rendered paste body<?phperror_reporting(0);$insgesamt = 0;$count_line = array();$dir = $_GET['dir'];$type = $_GET['type'];if(empty($dir) || empty($type)){ print "<p />Please tell me a Directory and the file type.</p><br>"; die;}$files = scandir($dir);if(empty($files[2])){ // without .(current Directory) and ..(last Directory) $thedir = explode("\\", $dir); if(sizeof($thedir) == 1 || empty($thedir[1]) ){ if(!preg_match("/[A-Za-z]/",$thedir[0])){ // $thedir[0] must be from a-z/A-Z/a-Z/A-z/.. print "<p />Invalid Directory</p>"; die; }else{ print "<p />The Directory '".$thedir[0]."' is empty or doesn't exists.</p><br />"; die; } }else{ print "<p />The Directory '".$thedir[count($thedir)-1]."' (in ".$thedir[0].") is empty or doesn't exists.</p><br />"; die; }}$cnt_files = 0;$the_files = array();foreach($files as $file){ if(preg_match("/(.*).".$type."$/", $file)){ $the_files[$cnt_files] = $file; $cnt_files++; }}if($cnt_files === 0){ print "<p />In the Directory you told doesn\'t have files of your type</p><br />"; die;}print "<table ><tr><td><b>".$type."</b></td><td><b>Lines</b></td></tr>";for($i = 0; $i < $cnt_files; $i++){ print "<tr><td><p />".$the_files[$i]."</p></td>"; $filed = fopen($dir."\\".$the_files[$i], "r"); while($blah = fgets($filed)){ if(preg_match("/\n/",$blah)){ $count_line[$the_files[$i]]++; $insgesamt++; } elseif(preg_match("/\r/",$blah)){ $count_line[$the_files[$i]]++; $insgesamt++; } elseif(preg_match("/\r\n/",$blah)){ $count_line[$the_files[$i]]++; $insgesamt++; } } fclose($filed); print "<td><p />".$count_line[$the_files[$i]]."</p></td></tr>";}print "<tr><td><p />--------------------------------</p></td><td><p />--------</p></td></tr>";print "<tr><td><p />total lines:</p></td><td><p />".$insgesamt."</p></td></tr></table>";?>