<?

    //include("authentication.php");

	include("conexao_e_agenda.php");

    include("funcoes.php");

//-------------------------------fim da autenticação---------------------//

//<photo image="bossbanner/images/03.jpg" >

//	<![CDATA[]]>

//	</photo>

if ($_SERVER["SERVER_ADDR"] == '127.0.0.1' ){

$filename = "../images.xml";//"../bossbanner/big2t.xml";

}else{

$filename = "/home/msoftx/public_html/cabelosecremes.com.br/store/images.xml";

}

$handle = fopen ("$filename", "w");

        

   //XML

   $xml  = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n";

   $xml .= "<slideshow>\n";

   

 $sql="select * from banner_principal_fotos where categoria='banner_principal' order by dt_banner desc";

 //EXECUTA A QUERY               

 $sql = mysqli_query($conexao,$sql);

 $linha_f=mysqli_fetch_array($sql);

 $row = mysqli_num_rows($sql);    



//VERIFICA SE VOLTOU ALGO 

 

if($row) { 

    //$xml .= "<pic>\n";  //  name=\"Introducing Seattle\"           

//---

   //PERCORRE ARRAY           <photo image="banner_afmm/f2.jpg" url="index.php" target="_self" duration="6">

	//<![CDATA[]]></photo> 

   for($i=0; $i<$row; $i++) { 

   $c = $i + 1; 

      $titulo    = mysqli_result($sql, $i, "titulo");

	  $texto    = mysqli_result($sql, $i, "texto");  

      $foto    = mysqli_result($sql, $i, "caminho_foto"); 

      $xml .= "<photo image=\"banner/images/".$foto."\" duration=\"6\">\n";               

      $xml .= "<![CDATA[]]>\n";

      $xml.= "</photo>\n";

   }//FECHA FOR                 

   

   //$xml.= "</pic>\n";

 } //FECHA IF (row)

//} 

   $xml.= "</slideshow>\n";

   //CABEÇALHO

   Header("Content-type: application/xml; charset=ISO-8859-1"); 

     

		if (is_writable($filename)) {



        // Escrevendo $$registro para o arquivo aberto.

        if (!fwrite($handle, $xml, 200024)) {

        print "Erro escrevendo no arquivo ($filename)";

        exit;

    	}

}



    fclose($handle);   

//------------------------------------------------------------

 header("location:cad_banner_principal_alt.php?id_c=$_GET[id_tcomp]");  

          

?>