| $dir = "./"; |
| opendir(DIR, $dir) or die $!; |
| while( defined( $fdir = readdir DIR) ) { |
| if( -d "$dir$fdir" ) { |
| $found = 0; |
| opendir(BIN, "$dir$fdir") or die "Can't open $fdir: $!"; |
| while( defined ($file = readdir BIN) ) { |
| if( $file =~ /index.php/ ) { |
| $found = 1; |
| } |
| if( $file =~ /main\.html/ ) { |
| open FILE, "$dir$fdir/$file" or die $!; |
| $whole = ""; |
| $mode = 0; |
| while( $line = <FILE> ) { |
| $mode = 2 if( $line =~ /<\/body/i ); |
| $whole .= $line if( $mode == 1 ); |
| $mode = 1 if( $line =~ /<body/i ); |
| } |
| close FILE; |
| $orig = $whole; |
| } |
| } |
| closedir(BIN); |
| if( !$found ) { |
| print "Not found in $fdir$dir\n"; |
| } |
| } |
| } |
| closedir(DIR); |