The following code for PHP to remove all file BOM information for the current directory and subdirectories, create a new file, put it down in the root directory, and then access the browser.
<?php if (isset ($_get[' dir ')) {//Set file directory $basedir = $_get[' dir '];} else {$basedir = '. '}
$auto = 1;
Checkdir ($basedir); function Checkdir ($basedir) {if ($dh = Opendir ($basedir)) {while ($file = Readdir ($DH))!== false) {if ($f Ile!= '. ' && $file!= ' ... ') {if (!is_dir, $basedir. "/" . $file)) {echo "filename: $basedir/$file". Checkbom ("$basedir/$file").
"<br>"; else {$dirname = $basedir. "/" .
$file;
Checkdir ($dirname);
}} closedir ($DH);
} function Checkbom ($filename) {global $auto;
$contents = file_get_contents ($filename);
$charset [1] = substr ($contents, 0, 1);
$charset [2] = substr ($contents, 1, 1);
$charset [3] = substr ($contents, 2, 1);
if (Ord ($charset [1]) = = 239 && ord ($charset [2]) = = 187 && ord ($charset [3]) = = 191) {if ($auto = = 1) {
$rest = substr ($contents, 3);
Rewrite ($filename, $rest); Return ("<font color= "Red" >bom found, automatically removed.</font> ");
else {return ("<font color=" Red ">bom found.</font>");
' Else return (' BOM not Found. ');
function rewrite ($filename, $data) {$filenum = fopen ($filename, "w");
Flock ($filenum, LOCK_EX);
Fwrite ($filenum, $data);
Fclose ($filenum); }?>
Of course the script widget has found a software version of the Detection tool: Download address http://www.jb51.net/softs/496779.html