<html><head><meta http-equiv="Content-Type" content="text/html; charset=windows-1256"></head><body>
 
<ul>
 
<?php
 
    include('ArCharsetD.class.php');
 
    $ard = new ArCharsetD();
 
 
    $dir = 'folder/';
 
 
    if ($dhandle = opendir($dir)) {
 
        while (false !== ($file = readdir($dhandle))) {
 
            if ($file != "." && $file != "..") {
 
                // get contents of a file into a string
 
                $fhandle = fopen($dir.$file, "r");
 
                $contents = fread($fhandle, filesize($dir.$file));
 
                fclose($fhandle);
 
 
                $charset = $ard->getCharset($contents);
 
                echo "<li>$file (<i>$charset</i>)</li>";
 
            }
 
        }
 
        closedir($dhandle);
 
    }
 
?>
 
</ul>
 
</body></html>
 
 |