So i ran a special dir command on about 2000 workstations. i then piped that out to a text file.
they look like
C:\blah\1234.txt
C:\windows\test.txt
C:\temp\blah.txt
etc etc etc
Well i got a lot of false positives, so i want to ignore lines that contain certain file names, and echo the rest.
So i created this
<?php
$__BADWORDSARRAY = array ("test.txt", "blah.txt");
function containsBadword($line) {
global $__BADWORDSARRAY;
for ($i = 0; $i < count($__BADWORDSARRAY); $i++) {
if (stristr($__BADWORDSARRAY[$i],$line)) {
return(true);
}
}
return(false);
}
$lines = file("c:\\test.txt");
foreach($lines as $linenum => $line){
if (!containsBadword($line)) {
echo $line . " - no bad words\r\n";
} else {
echo "omgwtfbbq!! potty mouth<br>";
}
}
?>
and my output is
c:\test.txt
- no bad words
blah.txt
- no bad words
test\blah.txt\test
- no bad words
testing
- no bad words
1234 - no bad words
so why isn't it finding text.txt and blah.txt