<?php
/*********************/
/*                   */
/*  Version : 5.1.0  */
/*  Author  : RM     */
/*  Comment : 071223 */
/*                   */
/*********************/

$pdiretorio = $_POST['diretorio'];
$d = dir( $dir );
$xml = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n";
$xml .= "<subcategorias>\n";
while ( false != ( $entry = $d->read( ) ) )
{
    if ( !( $entry != ".." ) && !( $entry != "." ) && !( pathinfo( $entry, PATHINFO_EXTENSION ) == "jpg" ) && !( strlen( $entry ) <= 10 ) )
    {
        $entry = substr( $entry, 0, 6 );
        $xml .= "<subcategoria>\n";
        $xml .= "<descricao>".$entry."</descricao>\n";
        $xml .= "</subcategoria>\n";
    }
}
$xml .= "</subcategorias>\n";
header( "Content-type: application/xml; charset=iso-8859-1" );
echo $xml;
?>
