403Webshell
Server IP : 23.111.136.34  /  Your IP : 216.73.216.136
Web Server : Apache
System : Linux servidor.eurohost.com.br 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64
User : meusitei ( 1072)
PHP Version : 5.6.40
Disable Function : show_source, system, shell_exec, passthru, proc_open
MySQL : ON  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /home/meusitei/public_html/painel/geradoresintegracao/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/meusitei/public_html/painel/geradoresintegracao//mercadolivre.php
<?php

// Topo
$dom = new DOMDocument("1.0", "utf-8");
$root = $dom->createElement("ListingDataFeed");
$dom->appendChild($root);
$dom->formatOutput = true;
/*
  $o = $dom->createAttribute("xmlns");
  $root->appendChild($o);
  $o1 = $dom->createTextNode("http://www.vivareal.com/schemas/1.0/VRSync");
  $o->appendChild($o1);
 */
$oo = $dom->createAttribute("xmlns:xsi");
$root->appendChild($oo);
$o2 = $dom->createTextNode("http://www.w3.org/2001/XMLSchema-instance");
$oo->appendChild($o2);

$ooo = $dom->createAttribute("xsi:noNamespaceSchemaLocation");
$root->appendChild($ooo);
$o3 = $dom->createTextNode("http://dev-test.mercadolibre.com/apps/validator.xsd");
$ooo->appendChild($o3);

/*
  $oo = $dom->createAttribute("xmlns:xsi");
  $root->appendChild($oo);

  $o2 = $dom->createTextNode("http://www.w3.org/2001/XMLSchema-instance");
  $oo->appendChild($o2);

  $ooo = $dom->createAttribute("xmlns:xsd");
  $root->appendChild($ooo);
  $o3 = $dom->createTextNode("http://www.w3.org/2001/XMLSchema");
  $ooo->appendChild($o3);
 */

// fim do topo
// header
/*
  $header = $dom->createElement("Header");
  $root->appendChild($header);
  $Provider = $dom->createElement("Provider");
  $header->appendChild($Provider);
  $titulositee = $dom->createTextNode('Titulo Site');
  $Provider->appendChild($titulositee);
  $emaill = $dom->createElement("Email");
  $header->appendChild($emaill);
  $email = $dom->createTextNode('E-mail Anunciante');
  $emaill->appendChild($email);
 */
//fim do header
//inicio do Listings
$Listings = $dom->createElement("imoveis");
$root->appendChild($Listings);

$email = $dom->createElement("email");
$Listings->appendChild($email);

$emailvalor = $dom->createTextNode($emailsistema);
$email->appendChild($emailvalor);

$imoveisintegrados = explode('-', $portal['imoveis']);

foreach ($imoveisintegrados as $campo) {
    $imovel_invalido_mercado = ''; 
    if (@$infoimovel[$campo] != null) {

//echo $campo.'1';
// create child element
    $campo = $infoimovel[$campo];
    $imovelvalido = 'nao';
    $validar = '1';
    if (($ddd1) && ($fone1) && ($campo['valor'] != null) && ($campo['cep_numero'] != null) && ($campo['cep_logradouro'] != null) && ($campo['cep_cidade'] != null) && ($campo['cep_estado'] != null) && ($campo['cep'] != null)) {
        $imovelvalido = 'sim';

        if (($campo['subtipoimovel'] == 'Chácara') || ($campo['subtipoimovel'] == 'Fazenda') || ($campo['subtipoimovel'] == 'Sítio')) {
            if ($campo['areatotal_medida'] != 'ha') {
                $imovelvalido = 'nao';
                $imovel_invalido_mercado .= 'Área Total Inválida'.'%';
            }
        }
        
        if (($campo['tipo'] == 'Apartamento') || ($campo['tipo'] == 'Casa')) {
            if (($campo['dormitorio'] == null)) {
                $imovelvalido = 'nao';
                $imovel_invalido_mercado .= 'Dormitório'.'%';
            }
            if (($campo['banheiro'] == null)) {
                $imovelvalido = 'nao';
                $imovel_invalido_mercado .= 'Banheiro'.'%';
            } 
        }
        if (($campo['tipo'] == 'Apartamento') || ($campo['tipo'] == 'Casa')) {
            if (($campo['dormitorio'] == '0')) {
                $imovelvalido = 'nao';
                $imovel_invalido_mercado .= 'Dormitório'.'%';
            }
            if (($campo['banheiro'] == null)) {
                $imovelvalido = 'nao';
                $imovel_invalido_mercado .= 'Banheiro'.'%';
            }
        }
        if ($campo['tipo'] == 'Comercial') {
            if ($campo['banheiro'] == null) {
                $imovelvalido = 'nao';
                $imovel_invalido_mercado .= 'Banheiro'.'%';
            }
        }
        if ($campo['tipo'] == 'Comercial') {
            if ($campo['banheiro'] == '0') {
                $imovelvalido = 'nao';
                $imovel_invalido_mercado .= 'Banheiro'.'%';
            }
        }
        
        if($campo['status'] != '0'){
            $imovelvalido = 'nao';
            $imovel_invalido_mercado .= 'Status do Imóvel: Arquivado'.'%';
        }

        if ($imovelvalido == 'sim') {
            $validar = '0';
            /////
           
            if (($campo['dormitorio'] == null) || ($campo['dormitorio'] == 0)) {
                $campo['dormitorio'] = 'Não';
            }          
           
            if (($campo['banheiro'] == null) || ($campo['banheiro'] == 0)) {
                $campo['banheiro'] = 'Não';
            }            
          
            if (($campo['suite'] == null) || ($campo['suite'] == 0)) {
                $campo['suite'] = 'Não';
            }
            
            if (($campo['garagem'] == null) || ($campo['garagem'] == 0)) {
                $campo['garagem'] = 'Não';
            }           

            if ($campo['cozinha'] > 0) {
                $campo['cozinha'] = 'Sim';
            } else {
                $campo['cozinha'] = 'Não';
            }


            if ($campo['garagem'] == null) {
                $campo['garagem'] = '0';
            }
            if ($campo['dormitorio'] == null) {
                $campo['dormitorio'] = '0';
            }
            if ($campo['banheiro'] == null) {
                $campo['banheiro'] = '0';
            }
            if ($campo['suite'] == null) {
                $campo['suite'] = '0';
            }
            if ($campo['areautil'] == null) {
                $campo['areautil'] = '0';
            }
            if ($campo['areatotal'] == null) {
                $campo['areatotal'] = '0';
            }

            /////

            if ($campo['negocio'] == 'Locação') {
                $campo['negocio'] = 'Aluguel';
            }
            $imovel = $dom->createElement("imovel");
            $Listings->appendChild($imovel);

            $CodigoImovel = $dom->createElement("imovelId");
            $imovel->appendChild($CodigoImovel);
            $codigoValue = $dom->createTextNode($campo['cod_referencia']);
            $CodigoImovel->appendChild($codigoValue);

            if($campo['tipo']=='Comercial'){
                $tipotitulo = $campo['subtipoimovel'].' - '.$campo['tipo'];
            }elseif($campo['tipo']=='Rural'){
                $tipotitulo = $campo['subtipoimovel'];
            }else{
                $tipotitulo = $campo['tipo'].' - '.$campo['subtipoimovel'];
            }
            
            $Title = $dom->createElement("title");
            $imovel->appendChild($Title);
            $TitleValue = $dom->createTextNode($tipotitulo.', para '.$campo['negocio'] . ' em ' . $campo['cep_cidade'] . '/' . $campo['cep_estado']);
            $Title->appendChild($TitleValue);

            $tipoimovel = 'Outros Imóveis';
            if ($campo['tipo'] == 'Casa') {
                $tipoimovel = 'Casas';
            }
            if ($campo['tipo'] == 'Apartamento') {
                $tipoimovel = 'Apartamentos';
            }
            if ($campo['tipo'] == 'Terreno') {
                $tipoimovel = 'Terrenos - Lotes';
            }
            if ($campo['tipo'] == 'Comercial') {
                $tipoimovel = 'Comerciais - Industriais';
            }
            if ($campo['subtipoimovel'] == 'Fazenda') {
                $tipoimovel = 'Fazendas';
            }
            if ($campo['subtipoimovel'] == 'Sítio') {
                $tipoimovel = 'Sítios';
            }
            if ($campo['subtipoimovel'] == 'Chácara') {
                $tipoimovel = 'Chácaras';
            }
            if ($campo['subtipoimovel'] == 'Flat') {
                $tipoimovel = 'Flat - Apart Hotel';
            }

            $Category = $dom->createElement("category");
            $imovel->appendChild($Category);
            $CategoryValue = $dom->createTextNode($tipoimovel . ' > ' . $campo['negocio']);
            $Category->appendChild($CategoryValue);

            $Price = $dom->createElement("price");
            $imovel->appendChild($Price);
            $imovel3 = str_replace('.', '', $campo['valor3']);
            $imovel3 = str_replace(',', '.', $imovel3);
            $imovel4 = explode('.', $imovel3);
            if($imovel4[1] == '00'){
                $imovel3 = $imovel4[0];
            }  
            $PriceValue = $dom->createTextNode($imovel3);
            $Price->appendChild($PriceValue);
            
                            
                $portal_info = $this->acaoglobal(array('integracoes', 'id'), 'get', 8);
                $portal_info_imoveis = $portal_info['imoveis'];
                $portal_info_imoveis_tipo = $portal_info['imoveis_tipo'];

                $list_info_imoveis = explode('-', $portal_info_imoveis);
                $list_info_imoveis_tipo = explode('-', $portal_info_imoveis_tipo);
                $cont_info_imovel = 0;
                foreach ($list_info_imoveis as $info_imovel) {
                    if (($list_info_imoveis[$cont_info_imovel] == $campo['id_imovel'])) {
                       if($list_info_imoveis_tipo[$cont_info_imovel] == 'silver'){
                            $info = 'silver';
                       }elseif ($list_info_imoveis_tipo[$cont_info_imovel] == 'gold') {
                            $info = 'gold';
                        }else{
                           $info = 'gold_premium';
                       }                     
                    }

                    if ($info_imovel != '') {
                        $cont_info_imovel++;
                    }
                }
         
            $listingType = $dom->createElement("listingType");
            $imovel->appendChild($listingType);
            $listingTypeValue = $dom->createTextNode($info);
            $listingType->appendChild($listingTypeValue);

            if ($campo['video'] != '') {
                $video = $dom->createElement("video");
                $imovel->appendChild($video);
                $videoValue = $dom->createTextNode($campo['video2']);
                $video->appendChild($videoValue);
            }

            $fotoss = unserialize($campo['fotos']);
            $pictures = $dom->createElement("pictures");
            $imovel->appendChild($pictures);
            if ($fotoss[0] != '') {
                $contfotos = 0;
                foreach ($fotoss as $imagem) {
                    if ($contfotos < 15) {
                        $imageURL = $dom->createElement("imageURL");
                        $pictures->appendChild($imageURL);
                        $imageURLValue = $dom->createTextNode(HOME_URI . 'subdominios/' . $_SESSION['userdata']['contratante'] . '/fotos/' . $campo['id_imovel'] . '/' . $imagem);
                        $imageURL->appendChild($imageURLValue);
                        $contfotos++;
                    }
                }
            } else {
                $imageURL = $dom->createElement("imageURL");
                $pictures->appendChild($imageURL);
                $imageURLValue = $dom->createTextNode(HOME_URI . 'views/_images/semfoto_800x600.jpg');
                $imageURL->appendChild($imageURLValue);
            }

            //// sellerContact - inicio
            $sellerContact = $dom->createElement("sellerContact");
            $imovel->appendChild($sellerContact);

            $contact = $dom->createElement("contact");
            $sellerContact->appendChild($contact);
            $contactValue = $dom->createTextNode($contactsistema);
            $contact->appendChild($contactValue);

            $areaCode = $dom->createElement("areaCode");
            $sellerContact->appendChild($areaCode);
            $areaCodeValue = $dom->createTextNode($ddd1);
            $areaCode->appendChild($areaCodeValue);

            $phone = $dom->createElement("phone");
            $sellerContact->appendChild($phone);
            $phoneValue = $dom->createTextNode($sis_fone1_mercadolivre);
            $phone->appendChild($phoneValue);

            $areaCode2 = $dom->createElement("areaCode2");
            $sellerContact->appendChild($areaCode2);
            $areaCode2Value = $dom->createTextNode($ddd2);
            $areaCode2->appendChild($areaCode2Value);

            $phone2 = $dom->createElement("phone2");
            $sellerContact->appendChild($phone2);
            $phone2Value = $dom->createTextNode($sis_fone2_mercadolivre);
            $phone2->appendChild($phone2Value);

            $email = $dom->createElement("email");
            $sellerContact->appendChild($email);
            $emailValue = $dom->createTextNode($emailsistema);
            $email->appendChild($emailValue);

            $webpage = $dom->createElement("webpage");
            $sellerContact->appendChild($webpage);
            $webpageValue = $dom->createTextNode($dominiosistema);
            $webpage->appendChild($webpageValue);

            //// sellerContact - fim
            //// Location - inicio
            $Location = $dom->createElement("location");
            $imovel->appendChild($Location);
            $LocationAddress = $dom->createElement("addressLine");
            $Location->appendChild($LocationAddress);
            if($campo['ocultarend'] == '0'){
                $LocationAddressValue = $dom->createTextNode($campo['cep_logradouro'] . ' ' . $campo['cep_numero']);
            }else{
                $LocationAddressValue = $dom->createTextNode("");
            }
            $LocationAddress->appendChild($LocationAddressValue);

            $zipCode = $dom->createElement("zipCode");
            $Location->appendChild($zipCode);
            $zipCodeValue = $dom->createTextNode($campo['cep']);
            $zipCode->appendChild($zipCodeValue);

            $neighborhood = $dom->createElement("neighborhood");
            $Location->appendChild($neighborhood);
            $neighborhoodValue = $dom->createTextNode($campo['cep_bairro']);
            $neighborhood->appendChild($neighborhoodValue);

            $city = $dom->createElement("city");
            $Location->appendChild($city);
            $cityValue = $dom->createTextNode($campo['cep_cidade']);
            $city->appendChild($cityValue);

            $state = $dom->createElement("state");
            $Location->appendChild($state);
            $stateValue = $dom->createTextNode($campo['cep_estado']);
            $state->appendChild($stateValue);

            $country = $dom->createElement("country");
            $Location->appendChild($country);
            $countryValue = $dom->createTextNode($campo['cep_pais']);
            $country->appendChild($countryValue);
            
            $Latitude = $dom->createElement("Latitude");
            $Location->appendChild($Latitude);
            if($campo['ocultarend'] == '0'){
                $latitudeCodeValue = $dom->createTextNode($campo['latitude']);
            }else{
                $latitudeCodeValue = $dom->createTextNode("");
            }    
            $Latitude->appendChild($latitudeCodeValue);

            $Longitude = $dom->createElement("Longitude");
            $Location->appendChild($Longitude);
           if($campo['ocultarend'] == '0'){
                $LongitudeCodeValue = $dom->createTextNode($campo['longitude']);
            }else{
                $LongitudeCodeValue = $dom->createTextNode("");
            } 
            $Longitude->appendChild($LongitudeCodeValue);
            //// Location - fim
            //if(($campo['andar']!=null)||($campo['valor_condominio']!=null)||($campo['valor_iptu']!=null)||($campo['dormitorio']!=null)||($campo['suite']!=null)||($campo['garagem']!=null)||($campo['areautil']!=null)||($campo['areatotal']!=null)){
            //// attributes - inicio

            $attributes = $dom->createElement("attributes");
            $imovel->appendChild($attributes);
            if ($campo['areatotal'] != null) {
                // area util
                $attribute = $dom->createElement("attribute");
                $attributes->appendChild($attribute);

                $attribute1n = $dom->createElement("name");
                $attribute->appendChild($attribute1n);
                if ($campo['tipo'] == 'Rural') {
                    $attribute1Name = $dom->createTextNode('Área total (Hectáres)');
                } else{
                    $attribute1Name = $dom->createTextNode('Área total (' . $campo['areatotal_medida'] . ')');
                }
                $attribute1n->appendChild($attribute1Name);

                $attribute1v = $dom->createElement("value");
                $attribute->appendChild($attribute1v);
                $attribute1Value = $dom->createTextNode($campo['areatotal']);
                $attribute1v->appendChild($attribute1Value);
            }
            if ($campo['tipo'] != 'Terreno') {
                if ($campo['areautil'] != null) {
                    // area util
                    $attribute = $dom->createElement("attribute");
                    $attributes->appendChild($attribute);

                    $attribute1n = $dom->createElement("name");
                    $attribute->appendChild($attribute1n);
                    if ($campo['tipo'] != 'Rural') {
                        $attribute1Name = $dom->createTextNode('Área útil (' . $campo['areautil_medida'] . ')');
                    } else {
                        if (($campo['subtipoimovel'] == 'Chácara') || ($campo['subtipoimovel'] == 'Fazenda') || ($campo['subtipoimovel'] == 'Sítio')) {
                            $attribute1Name = $dom->createTextNode('Área útil (Hectáres)');
                        } else {
                            if($campo['areautil_medida'] == 'ha'){
                                $campo['areautil_medida'] = 'Hectáres';
                            }
                            $attribute1Name = $dom->createTextNode('Área útil (' . $campo['areautil_medida'] . ')');
                        }
                    }
                    $attribute1n->appendChild($attribute1Name);

                    $attribute1v = $dom->createElement("value");
                    $attribute->appendChild($attribute1v);
                    $attribute1Value = $dom->createTextNode($campo['areautil']);
                    $attribute1v->appendChild($attribute1Value);
                }
                if (($campo['tipo'] == 'Terreno') || ($campo['tipo'] == 'Comercial') || ($campo['tipo'] == 'Apartamento') || ($campo['tipo'] == 'Casa') || ($campo['subtipoimovel'] == 'Flat') || ($campo['subtipoimovel'] == 'Chácara') || ($campo['subtipoimovel'] == 'Fazenda') || ($campo['subtipoimovel'] == 'Sítio')) {

                    if ($campo['banheiro'] != null) {
                        // banheiros
                        $attribute = $dom->createElement("attribute");
                        $attributes->appendChild($attribute);

                        $attribute1n = $dom->createElement("name");
                        $attribute->appendChild($attribute1n);
                        $attribute1Name = $dom->createTextNode('Banheiros');
                        $attribute1n->appendChild($attribute1Name);

                        $attribute1v = $dom->createElement("value");
                        $attribute->appendChild($attribute1v);
                        $attribute1Value = $dom->createTextNode($campo['banheiro']);
                        $attribute1v->appendChild($attribute1Value);
                    }
                    if ($campo['tipo'] != 'Comercial') {
                        if ($campo['dormitorio'] != null) {
                            // dormitorios
                            $attribute = $dom->createElement("attribute");
                            $attributes->appendChild($attribute);

                            $attribute1n = $dom->createElement("name");
                            $attribute->appendChild($attribute1n);
                            $attribute1Name = $dom->createTextNode('Dormitórios');
                            $attribute1n->appendChild($attribute1Name);

                            $attribute1v = $dom->createElement("value");
                            $attribute->appendChild($attribute1v);
                            $attribute1Value = $dom->createTextNode($campo['dormitorio']);
                            $attribute1v->appendChild($attribute1Value);
                        }
                    }
                }
                if ($campo['tipo'] != 'Rural') {
                    // cozinha
                    $attribute = $dom->createElement("attribute");
                    $attributes->appendChild($attribute);

                    $attribute1n = $dom->createElement("name");
                    $attribute->appendChild($attribute1n);
                    $attribute1Name = $dom->createTextNode('Cozinha');
                    $attribute1n->appendChild($attribute1Name);

                    $attribute1v = $dom->createElement("value");
                    $attribute->appendChild($attribute1v);
                    $attribute1Value = $dom->createTextNode($campo['cozinha']);
                    $attribute1v->appendChild($attribute1Value);


                    if ($campo['garagem'] != null) {
                        // garagem
                        $attribute = $dom->createElement("attribute");
                        $attributes->appendChild($attribute);

                        $attribute1n = $dom->createElement("name");
                        $attribute->appendChild($attribute1n);
                        $attribute1Name = $dom->createTextNode('Qtd de vagas de garagem');
                        $attribute1n->appendChild($attribute1Name);

                        $attribute1v = $dom->createElement("value");
                        $attribute->appendChild($attribute1v);
                        $attribute1Value = $dom->createTextNode($campo['garagem']);
                        $attribute1v->appendChild($attribute1Value);
                    }


                    if ($campo['tipo'] != 'Comercial') {
                        if ($campo['suite'] != null) {
                            // suite
                            $attribute = $dom->createElement("attribute");
                            $attributes->appendChild($attribute);

                            $attribute1n = $dom->createElement("name");
                            $attribute->appendChild($attribute1n);
                            $attribute1Name = $dom->createTextNode('Suítes');
                            $attribute1n->appendChild($attribute1Name);

                            $attribute1v = $dom->createElement("value");
                            $attribute->appendChild($attribute1v);
                            $attribute1Value = $dom->createTextNode($campo['suite']);
                            $attribute1v->appendChild($attribute1Value);
                        }
                    }

                    if (($campo['tipo'] == 'Casa') || ($campo['tipo'] == 'Apartamento')) {

                        if ($campo['valor_condominio'] != null) {
                            // valor do condominio
                            $attribute = $dom->createElement("attribute");
                            $attributes->appendChild($attribute);

                            $attribute1n = $dom->createElement("name");
                            $attribute->appendChild($attribute1n);
                            $attribute1Name = $dom->createTextNode('Valor do Condomínio');
                            $attribute1n->appendChild($attribute1Name);

                            $attribute1v = $dom->createElement("value");
                            $attribute->appendChild($attribute1v);
                            $attribute1Value = $dom->createTextNode($campo['valor_condominio']);
                            $attribute1v->appendChild($attribute1Value);
                        }

                        if ($campo['valor_iptu'] != null) {
                            // valor do iptu
                            $attribute = $dom->createElement("attribute");
                            $attributes->appendChild($attribute);

                            $attribute1n = $dom->createElement("name");
                            $attribute->appendChild($attribute1n);
                            $attribute1Name = $dom->createTextNode('Valor do IPTU');
                            $attribute1n->appendChild($attribute1Name);

                            $attribute1v = $dom->createElement("value");
                            $attribute->appendChild($attribute1v);
                            $attribute1Value = $dom->createTextNode($campo['valor_iptu']);
                            $attribute1v->appendChild($attribute1Value);
                        }

                        if (($campo['orientacao'] == 'Norte') || ($campo['orientacao'] == 'Sul')) {
                            // valor do iptu
                            $attribute = $dom->createElement("attribute");
                            $attributes->appendChild($attribute);

                            $attribute1n = $dom->createElement("name");
                            $attribute->appendChild($attribute1n);
                            $attribute1Name = $dom->createTextNode('Posição do Imóvel');
                            $attribute1n->appendChild($attribute1Name);

                            $attribute1v = $dom->createElement("value");
                            $attribute->appendChild($attribute1v);
                            $attribute1Value = $dom->createTextNode('Face ' . $campo['orientacao']);
                            $attribute1v->appendChild($attribute1Value);
                        }
                    }
                }
            }
            if ($campo['tipo'] == 'Terreno') {

                if ($campo['valor_iptu'] != null) {
                    // valor do iptu
                    $attribute = $dom->createElement("attribute");
                    $attributes->appendChild($attribute);

                    $attribute1n = $dom->createElement("name");
                    $attribute->appendChild($attribute1n);
                    $attribute1Name = $dom->createTextNode('Valor do IPTU');
                    $attribute1n->appendChild($attribute1Name);

                    $attribute1v = $dom->createElement("value");
                    $attribute->appendChild($attribute1v);
                    $attribute1Value = $dom->createTextNode($campo['valor_iptu']);
                    $attribute1v->appendChild($attribute1Value);
                }
            }
            //if ($campo['detalhes'] != null) {
            $caracteristicas = unserialize($campo['caracteristicas']);

            $contchurrasqueira = 'Não';
            $conttelefone = 'Não';
            $contpiscina = 'Não';

            if (($campo['tipo'] == 'Casa') || ($campo['tipo'] == 'Apartamento')) {
                $contarcentral = 'Não';
                $contareaservico = 'Não';
                $contarmarioembutido = 'Não';
                $contbiblioteca = 'Não';
                $contcampodefutebol = 'Não';
                $contchildrencare = 'Não';
                $contcloset = 'Não';
                $contcopa = 'Não';
                $contdepositoprivativo = 'Não';
                $contelevadordeservico = 'Não';
                $contescritorio = 'Não';
                $contestacionamentovisitantes = 'Não';
                $continternet = 'Não';
                $contjacuzzi = 'Não';
                $contjardim = 'Não';
                $contlareira = 'Não';
                $contlavabo = 'Não';
                $contlavanderiacoletiva = 'Não';
                $contplayground = 'Não';
                $contquadradetenis = 'Não';
                $contquadrapoliesportiva = 'Não';
                $contquartoempregada = 'Não';
                $contsaladeestar = 'Não';
                $contsaladeginastiva = 'Não';
                $contsaladejantar = 'Não';
                $contsalaintima = 'Não';
                $contsalaodefestas = 'Não';
                $contsalaodejogos = 'Não';
                $contsauna = 'Não';
                $contsegurança = 'Não';
                $contspa = 'Não';
                $contsaunaspa = 'Não';
                $contterraco = 'Não';
                $conttvacabo = 'Não';
            }
            if ($campo['tipo'] == 'Casa') {
                $contsotao = 'Não';
                $contquintal = 'Não';
                $contalarme = 'Não';
            }
            if ($campo['tipo'] == 'Rural') {
                $contagua = 'Não';
                $contaquecimentoagas = 'Não';
                $contcasadecaseiro = 'Não';
                $contgerador = 'Não';
                $contluzeletrica = 'Não';
                $contsede = 'Não';
                if ($campo['negocio'] == 'Temporada') {
                    $contbanheira = 'Não';
                    $contfogao = 'Não';
                    $contgeladeira = 'Não';
                }
            }
            if ($campo['tipo'] == 'Terreno') {
                $contagua = 'Não';
                $contaquecimentoagas = 'Não';
                $contluzeletrica = 'Não';
            }
            if($caracteristicas[0] != ''){
             foreach ($caracteristicas as $detalhe) {
                            if ($detalhe == '474'){
                                $detalhe  = 'Coffee Shop';
                            }if($detalhe == '473'){
                                $detalhe  = 'Closet';
                            }if($detalhe == '472'){
                                $detalhe  = 'Cinema';
                            }if($detalhe == '471'){
                                $detalhe  = 'Churrasqueira';
                            }if($detalhe == '470'){
                                $detalhe  = 'Children Care';
                            }if($detalhe == '469'){
                                $detalhe  = 'Cerca';
                            }if($detalhe == '468'){
                                $detalhe  = 'Centro de estética';
                            }if($detalhe == '467'){
                                $detalhe  = 'Central telefônica';
                            }if($detalhe == '466'){
                                $detalhe  = 'Caseiro';
                            }if($detalhe == '465'){
                                $detalhe  = 'Casa de Fundo';
                            }if($detalhe == '464'){
                                $detalhe  = 'Casa de Caseiro';
                            }if($detalhe == '463'){
                                $detalhe  = 'Casa de Boneca';
                            }if($detalhe == '462'){
                                $detalhe  = 'Carpete';
                            }if($detalhe == '461'){
                                $detalhe  = 'Car Wash';
                            }if($detalhe == '460'){
                                $detalhe  = 'Campo de Golfe';
                            }if($detalhe == '459'){
                                $detalhe  = 'Campo de futebol';
                            }if($detalhe == '458'){
                                $detalhe  = 'Cameras de segurança';
                            }if($detalhe == '457'){
                                $detalhe  = 'Canil';
                            }if($detalhe == '456'){
                                $detalhe  = 'Business Center';
                            }if($detalhe == '455'){
                                $detalhe  = 'Bosque';
                            }if($detalhe == '454'){
                                $detalhe  = 'Brinquedoteca';
                            }if($detalhe == '453'){
                                $detalhe  = 'Bicicletário';
                            }if($detalhe == '452'){
                                $detalhe  = 'Bar';
                            }if($detalhe == '451'){
                                $detalhe  = 'Armário Embutido';
                            }if($detalhe == '450'){
                                $detalhe  = 'Armário Cozinha';
                            }if($detalhe == '449'){
                                $detalhe  = 'Área de serviço';
                            }if($detalhe == '448'){
                                $detalhe  = 'Ar Condicionado';
                            }if($detalhe == '447'){
                                $detalhe  = 'Água';
                            }if($detalhe == '446'){
                                $detalhe  = 'Aquecimento Central';
                            }if($detalhe == '445'){
                                $detalhe  = 'Aquecedor';
                            }if($detalhe == '444'){
                                $detalhe  = 'Acesso para deficientes';
                            }if($detalhe == '443'){
                                $detalhe  = 'Acesso 24 Horas';
                            }if($detalhe == '442'){
                                $detalhe  = 'Academia';
                            }if($detalhe == '484'){
                                $detalhe  = 'Entrada de Caminhões';
                            }if($detalhe == '483'){
                                $detalhe  = 'Elevador';
                            }if($detalhe == '482'){
                                $detalhe  = 'Edícula';
                            }if($detalhe == '481'){
                                $detalhe  = 'Despensa';
                            }if($detalhe == '480'){
                                $detalhe  = 'Dependência de empregados';
                            }if($detalhe == '479'){
                                $detalhe  = 'Curral';
                            }if($detalhe == '478'){
                                $detalhe  = 'Cozinha Gourmet';
                            }if($detalhe == '477'){
                                $detalhe  = 'Cozinha americana';
                            }if($detalhe == '476'){
                                $detalhe  = 'Copa';
                            }if($detalhe == '475'){
                                $detalhe  = 'Convenções';
                            }if($detalhe == '485'){
                                $detalhe  = 'Entrada lateral';
                            }if($detalhe == '486'){
                                $detalhe  = 'Escritório';
                            }if($detalhe == '487'){
                                $detalhe  = 'Escritório Virtual';
                            }if($detalhe == '488'){
                                $detalhe  = 'Esgoto';
                            }if($detalhe == '489'){
                                $detalhe  = 'Espaço Gourmet';
                            }if($detalhe == '490'){
                                $detalhe  = 'Espaço zen';
                            }if($detalhe == '491'){
                                $detalhe  = 'Esquina';
                            }if($detalhe == '492'){
                                $detalhe  = 'Estacionamento para visitantes';
                            }if($detalhe == '493'){
                                $detalhe  = 'Estacionamento Rotativo';
                            }if($detalhe == '494'){
                                $detalhe  = 'Estacionamento Visitantes';
                            }if($detalhe== '495'){
                                $detalhe  = 'Estrada Asfaltada';
                            }if($detalhe == '496'){
                                $detalhe  = 'Fitness';
                            }if($detalhe == '497'){
                                $detalhe  = 'Forno de pizza';
                            }if($detalhe == '498'){
                                $detalhe  = 'Frente para o Mar';
                            }if($detalhe == '499'){
                                $detalhe  = 'Fogão elétrico';
                            }if($detalhe == '500'){
                                $detalhe  = 'Galpão';
                            }if($detalhe == '501'){
                                $detalhe  = 'Garagem para Barcos';
                            }if($detalhe == '502'){
                                $detalhe  = 'Gerador';
                            }if($detalhe == '503'){
                                $detalhe  = 'Geminada';
                            }if($detalhe == '504'){
                                $detalhe  = 'Guarita';
                            }if($detalhe == '505'){
                                $detalhe  = 'Heliponto';
                            }if($detalhe == '506'){
                                $detalhe  = 'Hidromassagem';
                            }if($detalhe == '507'){
                                $detalhe  = 'Infra-estrutura Internet';
                            }if($detalhe == '508'){
                                $detalhe  = 'Interfone';
                            }if($detalhe == '509'){
                                $detalhe  = 'Jardim';
                            }if($detalhe == '510'){
                                $detalhe  = 'Lago';
                            }if($detalhe == '511'){
                                $detalhe  = 'Lan House';
                            }if($detalhe == '512'){
                                $detalhe  = 'Lareira';
                            }if($detalhe == '513'){
                                $detalhe  = 'Lavabo';
                            }if($detalhe == '514'){
                                $detalhe  = 'Lavanderia';
                            }if($detalhe == '515'){
                                $detalhe  = 'Lavoura';
                            }if($detalhe == '516'){
                                $detalhe  = 'Luminárias';
                            }if($detalhe == '517'){
                                $detalhe  = 'Luz';
                            }if($detalhe == '518'){
                                $detalhe  = 'Marina';
                            }if($detalhe == '519'){
                                $detalhe  = 'Mezanino';
                            }if($detalhe == '520'){
                                $detalhe  = 'Mobiliado';
                            }if($detalhe == '521'){
                                $detalhe  = 'Paiol';
                            }if($detalhe == '522'){
                                $detalhe  = 'Pasto';
                            }if($detalhe == '523'){
                                $detalhe  = 'Pátio Estacionamento';
                            }if($detalhe == '524'){
                                $detalhe  = 'Permite Animais';
                            }if($detalhe == '525'){
                                $detalhe  = 'Pet Care';
                            }if($detalhe == '526'){
                                $detalhe  = 'Píer';
                            }if($detalhe == '527'){
                                $detalhe  = 'Piscina';
                            }if($detalhe == '528'){
                                $detalhe  = 'Piscina aquecida';
                            }if($detalhe == '529'){
                                $detalhe  = 'Pscina Climatizada';
                            }if($detalhe == '530'){
                                $detalhe  = 'Piscina Coberta';
                            }if($detalhe == '531'){
                                $detalhe  = 'Piscina Infantil';
                            }if($detalhe == '532'){
                                $detalhe  = 'Piso Elevado';
                            }if($detalhe == '533'){
                                $detalhe  = 'Pista de cooper';
                            }if($detalhe == '534'){
                                $detalhe  = 'Pista de Pouso';
                            }if($detalhe == '535'){
                                $detalhe  = 'Pista de Skate';
                            }if($detalhe == '536'){
                                $detalhe  = 'Playground';
                            }if($detalhe == '537'){
                                $detalhe  = 'Poço Artesiano';
                            }if($detalhe == '538'){
                                $detalhe  = 'Pomar';
                            }if($detalhe == '539'){
                                $detalhe  = 'Ponte Rolante';
                            }if($detalhe == '540'){
                                $detalhe  = 'Portão Eletrônico';
                            }if($detalhe == '541'){
                                $detalhe  = 'Portaria 24 horas';
                            }if($detalhe == '542'){
                                $detalhe  = 'Porteira Fechada';
                            }if($detalhe == '543'){
                                $detalhe  = 'Quadra de futebol de salão';
                            }if($detalhe == '544'){
                                $detalhe  = 'Quadra Poliesportiva';
                            }if($detalhe == '545'){
                                $detalhe  = 'Quadra de Squash';
                            }if($detalhe == '546'){
                                $detalhe  = 'Quadra de Tênis';
                            }if($detalhe == '547'){
                                $detalhe  = 'Quarto da Empregada';
                            }if($detalhe == '548'){
                                $detalhe  = 'Quintal';
                            }if($detalhe == '549'){
                                $detalhe  = 'Redario';
                            }if($detalhe == '550'){
                                $detalhe  = 'Rede de Telefone';
                            }if($detalhe == '551'){
                                $detalhe  = 'Refeitório';
                            }if($detalhe == '552'){
                                $detalhe  = 'Reservatório de Água';
                            }if($detalhe == '553'){
                                $detalhe  = 'Restaurante';
                            }if($detalhe == '554'){
                                $detalhe  = 'Rio';
                            }if($detalhe == '555'){
                                $detalhe  = 'Ronda/Vigilância';
                            }if($detalhe == '556'){
                                $detalhe  = 'Rua Asfaltada';
                            }if($detalhe == '557'){
                                $detalhe  = 'Sala de Almoço';
                            }if($detalhe == '558'){
                                $detalhe  = 'Sala de Ginástica';
                            }if($detalhe == '559'){
                                $detalhe  = 'Sala de Jantar';
                            }if($detalhe == '560'){
                                $detalhe  = 'Sala íntima';
                            }if($detalhe == '561'){
                                $detalhe  = 'Salão de convenções';
                            }if($detalhe == '562'){
                                $detalhe  = 'Salão de Festas';
                            }if($detalhe == '563'){
                                $detalhe  = 'Salão de Jogos';
                            }if($detalhe == '564'){
                                $detalhe  = 'Salão de Vídeo/Cinema';
                            }if($detalhe == '565'){
                                $detalhe  = 'Sauna';
                            }if($detalhe == '566'){
                                $detalhe  = 'Sede';
                            }if($detalhe == '567'){
                                $detalhe  = 'Segurança Interna';
                            }if($detalhe == '568'){
                                $detalhe  = 'Segurança na Rua';
                            }if($detalhe == '569'){
                                $detalhe  = 'Segurança Patrimonial';
                            }if($detalhe == '570'){
                                $detalhe  = 'Semigeminada';
                            }if($detalhe == '571'){
                                $detalhe  = 'Silos';
                            }if($detalhe == '572'){
                                $detalhe  = 'Sistema de alarme';
                            }if($detalhe == '573'){
                                $detalhe  = 'Sistema de Incêndio';
                            }if($detalhe == '574'){
                                $detalhe  = 'Solariam';
                            }if($detalhe == '575'){
                                $detalhe  = 'Telefone';
                            }if($detalhe == '576'){
                                $detalhe  = 'Terraço';
                            }if($detalhe == '577'){
                                $detalhe  = 'TV';
                            }if($detalhe == '578'){
                                $detalhe  = 'TV a cabo';
                            }if($detalhe == '579'){
                                $detalhe  = 'Varanda';
                            }if($detalhe == '580'){
                                $detalhe  = 'Varanda Goumert';
                            }if($detalhe == '581'){
                                $detalhe  = 'Ventilador de Teto';
                            }if($detalhe == '582'){
                                $detalhe  = 'Vestiário';
                            }if($detalhe == '583'){
                                $detalhe  = 'Vigilância 24hs';
                            }if($detalhe == '584'){
                                $detalhe  = 'WC Empregada';
                            }

                if (($detalhe == 'Telefone') || ($detalhe == 'telefone')) {
                    $conttelefone = 'Sim';
                }
                if (($detalhe == 'Churrasqueira') || ($detalhe == 'churrasqueira')) {
                    $contchurrasqueira = 'Sim';
                }
                if (($detalhe == 'Piscina') || ($detalhe == 'piscina')) {
                    $contpiscina = 'Sim';
                }

                if ($campo['tipo'] == 'Rural') {
                    if (($detalhe == 'Água') || ($detalhe == 'água')) {
                        $contagua = 'Sim';
                    }
                    if (($detalhe == 'Aquecimento à gás') || ($detalhe == 'aquecimento à gás')) {
                        $contaquecimentoagas = 'Sim';
                    }
                    if (($detalhe == 'Casa de Caseiro') || ($detalhe == 'Casa de caseiro')) {
                        $contcasadecaseiro = 'Sim';
                    }
                    if (($detalhe == 'Gerador') || ($detalhe == 'gerador')) {
                        $contgerador = 'Sim';
                    }
                    if (($detalhe == 'Aquecimento à gás') || ($detalhe == 'aquecimento à gás')) {
                        $contluzeletrica = 'Sim';
                    }
                    if (($detalhe == 'Casa de Caseiro') || ($detalhe == 'Casa de caseiro')) {
                        $contsede = 'Sim';
                    }

                    if ($campo['negocio'] == 'Temporada') {
                        if (($detalhe == 'Banheira') || ($detalhe == 'banheira')) {
                            $contbanheira = 'Sim';
                        }
                        if (($detalhe == 'Fogão') || ($detalhe == 'fogão')) {
                            $contfogao = 'Sim';
                        }
                        if (($detalhe == 'Geladeira') || ($detalhe == 'geladeira')) {
                            $contgeladeira = 'Sim';
                        }
                    }
                }

                if ($campo['tipo'] == 'Casa') {
                    if (($detalhe == 'Sotão') || ($detalhe == 'sotão')) {
                        $contsotao = 'Sim';
                    }
                    if (($detalhe == 'Quintal') || ($detalhe == 'quintal')) {
                        $contquintal = 'Sim';
                    }
                    if (($detalhe == 'Alarme') || ($detalhe == 'alarme')) {
                        $contalarme = 'Sim';
                    }
                }
                if (($campo['tipo'] == 'Casa') || ($campo['tipo'] == 'Apartamento')) {
                    if (($detalhe == 'Terraço') || ($detalhe == 'terraço')) {
                        $contterraco = 'Sim';
                    }
                    if (($detalhe == 'TV a Cabo') || ($detalhe == 'Tv a cabo') || ($detalhe == 'tv a cabo')) {
                        $conttvacabo = 'Sim';
                    }
                    if (($detalhe == 'Sala de Ginástica') || ($detalhe == 'Sala de ginástica') || ($detalhe == 'sala de ginástica')) {
                        $contsaladeginastiva = 'Sim';
                    }
                    if (($detalhe == 'Sala de Jantar') || ($detalhe == 'Sala de jantar') || ($detalhe == 'sala de jantar')) {
                        $contsaladejantar = 'Sim';
                    }
                    if (($detalhe == 'Sala Íntima') || ($detalhe == 'Sala íntima') || ($detalhe == 'sala íntima')) {
                        $contsalaintima = 'Sim';
                    }
                    if (($detalhe == 'Salão de Festas') || ($detalhe == 'Salão de festas') || ($detalhe == 'salão de festas')) {
                        $contsalaodefestas = 'Sim';
                    }
                    if (($detalhe == 'Salão de Jogos') || ($detalhe == 'Salão de jogos') || ($detalhe == 'salão de jogos')) {
                        $contsalaodejogos = 'Sim';
                    }
                    if (($detalhe == 'Sauna') || ($detalhe == 'sauna')) {
                        $contsauna = 'Sim';
                    }
                    if (($detalhe == 'Segurança') || ($detalhe == 'segurança')) {
                        $contsegurança = 'Sim';
                    }
                    if (($detalhe == 'Sauna') || ($detalhe == 'sauna') || ($detalhe == 'Spa') || ($detalhe == 'spa')) {
                        $contsaunaspa = 'Sim';
                    }
                    if (($detalhe == 'Spa') || ($detalhe == 'spa')) {
                        $contspa = 'Sim';
                    }
                    if (($detalhe == 'Playground') || ($detalhe == 'playground')) {
                        $contplayground = 'Sim';
                    }
                    if (($detalhe == 'Quadra de Tenis') || ($detalhe == 'Quadra de tenis') || ($detalhe == 'quadra de tenis')) {
                        $contquadradetenis = 'Sim';
                    }
                    if (($detalhe == 'Quadra Poliesportiva') || ($detalhe == 'Quadra poliesportiva') || ($detalhe == 'quadra poliesportiva')) {
                        $contquadrapoliesportiva = 'Sim';
                    }
                    if (($detalhe == 'Quarto de Empregada') || ($detalhe == 'Quarto de empregada')) {
                        $contquartoempregada = 'Sim';
                    }
                    if (($detalhe == 'Sala de Estar') || ($detalhe == 'Sala de estar')) {
                        $contsaladeestar = 'Sim';
                    }
                    if (($detalhe == 'Internet') || ($detalhe == 'internet')) {
                        $continternet = 'Sim';
                    }
                    if (($detalhe == 'Jacuzzi') || ($detalhe == 'jacuzzi')) {
                        $contjacuzzi = 'Sim';
                    }
                    if (($detalhe == 'Jardim') || ($detalhe == 'jardim')) {
                        $contjardim = 'Sim';
                    }
                    if (($detalhe == 'Lareira') || ($detalhe == 'lareira')) {
                        $contlareira = 'Sim';
                    }
                    if (($detalhe == 'Lavabo') || ($detalhe == 'lavabo')) {
                        $contlavabo = 'Sim';
                    }
                    if (($detalhe == 'Lavanderia Coletiva') || ($detalhe == 'Lavanderia coletiva') || ($detalhe == 'lavanderia coletiva')) {
                        $contlavanderiacoletiva = 'Sim';
                    }

                    if (($detalhe == 'Elevador de Serviço') || ($detalhe == 'Elevador de serviço') || ($detalhe == 'elevador de serviço')) {
                        $contelevadordeservico = 'Sim';
                    }
                    if (($detalhe == 'Escritório') || ($detalhe == 'escritório')) {
                        $contescritorio = 'Sim';
                    }
                    if (($detalhe == 'Estacionamento visitante') || ($detalhe == 'Estacionamento de visitante') || ($detalhe == 'Estacionamento Visitante') || ($detalhe == 'Estacionamento de Visitante')) {
                        $contestacionamentovisitantes = 'Sim';
                    }
                    if (($detalhe == 'Campo de Futebol') || ($detalhe == 'Campo de futebol') || ($detalhe == 'campo de futebol')) {
                        $contcampodefutebol = 'Sim';
                    }
                    if (($detalhe == 'Children Care') || ($detalhe == 'Children care') || ($detalhe == 'children care')) {
                        $contchildrencare = 'Sim';
                    }
                    if (($detalhe == 'Closet') || ($detalhe == 'closet')) {
                        $contcloset = 'Sim';
                    }
                    if (($detalhe == 'Copa') || ($detalhe == 'copa')) {
                        $contcopa = 'Sim';
                    }
                    if (($detalhe == 'Depósito Privativo') || ($detalhe == 'Depósito privativo') || ($detalhe == 'depósito privativo')) {
                        $contdepositoprivativo = 'Sim';
                    }
                    if (($detalhe == 'Ar Condicionado Central') || ($detalhe == 'ar condicionado central') || ($detalhe == 'Ar condicionado central')) {
                        $contarcentral = 'Sim';
                    }
                    if (($detalhe == 'Area de Serviço') || ($detalhe == 'Area de serviço') || ($detalhe == 'area de serviço')) {
                        $contareaservico = 'Sim';
                    }
                    if (($detalhe == 'Armarios Embutidos') || ($detalhe == 'Armarios embutidos') || ($detalhe == 'armarios embutidos')) {
                        $contarmarioembutido = 'Sim';
                    }
                    if (($detalhe == 'Biblioteca') || ($detalhe == 'biblioteca')) {
                        $contbiblioteca = 'Sim';
                    }
                }
            }            
            }

            if (($campo['tipo'] == 'Terreno') || ($campo['tipo'] == 'Comercial') || ($campo['tipo'] == 'Apartamento') || ($campo['tipo'] == 'Casa') || ($campo['subtipoimovel'] == 'Flat') || ($campo['subtipoimovel'] == 'Chácara') || ($campo['subtipoimovel'] == 'Fazenda') || ($campo['subtipoimovel'] == 'Sítio')) {
                if ($campo['tipo'] != 'Terreno') {
                    if ($campo['tipo'] != 'Comercial') {

                        // churrasqueira
                        $attribute = $dom->createElement("attribute");
                        $attributes->appendChild($attribute);

                        $attribute1n = $dom->createElement("name");
                        $attribute->appendChild($attribute1n);
                        $attribute1Name = $dom->createTextNode('Churrasqueira');
                        $attribute1n->appendChild($attribute1Name);

                        $attribute1v = $dom->createElement("value");
                        $attribute->appendChild($attribute1v);
                        $attribute1Value = $dom->createTextNode($contchurrasqueira);
                        $attribute1v->appendChild($attribute1Value);

                        // Piscina
                        $attribute = $dom->createElement("attribute");
                        $attributes->appendChild($attribute);

                        $attribute1n = $dom->createElement("name");
                        $attribute->appendChild($attribute1n);
                        $attribute1Name = $dom->createTextNode('Piscina');
                        $attribute1n->appendChild($attribute1Name);

                        $attribute1v = $dom->createElement("value");
                        $attribute->appendChild($attribute1v);
                        $attribute1Value = $dom->createTextNode($contpiscina);
                        $attribute1v->appendChild($attribute1Value);
                    }
                }
                // telefone
                $attribute = $dom->createElement("attribute");
                $attributes->appendChild($attribute);

                $attribute1n = $dom->createElement("name");
                $attribute->appendChild($attribute1n);
                if (($campo['tipo'] == 'Terreno') || ($campo['tipo'] == 'Comercial')) {
                    $nometelefone = 'Rede de Telefone';
                } else {
                    $nometelefone = 'Telefone';
                }
                $attribute1Name = $dom->createTextNode($nometelefone);
                $attribute1n->appendChild($attribute1Name);

                $attribute1v = $dom->createElement("value");
                $attribute->appendChild($attribute1v);
                $attribute1Value = $dom->createTextNode($conttelefone);
                $attribute1v->appendChild($attribute1Value);

                if ($campo['tipo'] == 'Terreno') {


                    // Água
                    $attribute = $dom->createElement("attribute");
                    $attributes->appendChild($attribute);

                    $attribute1n = $dom->createElement("name");
                    $attribute->appendChild($attribute1n);
                    $attribute1Name = $dom->createTextNode('Água');
                    $attribute1n->appendChild($attribute1Name);

                    $attribute1v = $dom->createElement("value");
                    $attribute->appendChild($attribute1v);
                    $attribute1Value = $dom->createTextNode($contagua);
                    $attribute1v->appendChild($attribute1Value);

                    // aquecimento a gas
                    $attribute = $dom->createElement("attribute");
                    $attributes->appendChild($attribute);

                    $attribute1n = $dom->createElement("name");
                    $attribute->appendChild($attribute1n);
                    $attribute1Name = $dom->createTextNode('Aquecimento a Gás');
                    $attribute1n->appendChild($attribute1Name);

                    $attribute1v = $dom->createElement("value");
                    $attribute->appendChild($attribute1v);
                    $attribute1Value = $dom->createTextNode($contaquecimentoagas);
                    $attribute1v->appendChild($attribute1Value);

                    // luz eletrica
                    $attribute = $dom->createElement("attribute");
                    $attributes->appendChild($attribute);

                    $attribute1n = $dom->createElement("name");
                    $attribute->appendChild($attribute1n);
                    $attribute1Name = $dom->createTextNode('Luz elétrica');
                    $attribute1n->appendChild($attribute1Name);

                    $attribute1v = $dom->createElement("value");
                    $attribute->appendChild($attribute1v);
                    $attribute1Value = $dom->createTextNode($contluzeletrica);
                    $attribute1v->appendChild($attribute1Value);
                }

                if ($campo['tipo'] == 'Rural') {

                    // Água
                    $attribute = $dom->createElement("attribute");
                    $attributes->appendChild($attribute);

                    $attribute1n = $dom->createElement("name");
                    $attribute->appendChild($attribute1n);
                    $attribute1Name = $dom->createTextNode('Água');
                    $attribute1n->appendChild($attribute1Name);

                    $attribute1v = $dom->createElement("value");
                    $attribute->appendChild($attribute1v);
                    $attribute1Value = $dom->createTextNode($contagua);
                    $attribute1v->appendChild($attribute1Value);

                    // aquecimento a gas
                    $attribute = $dom->createElement("attribute");
                    $attributes->appendChild($attribute);

                    $attribute1n = $dom->createElement("name");
                    $attribute->appendChild($attribute1n);
                    $attribute1Name = $dom->createTextNode('Aquecimento a Gás');
                    $attribute1n->appendChild($attribute1Name);

                    $attribute1v = $dom->createElement("value");
                    $attribute->appendChild($attribute1v);
                    $attribute1Value = $dom->createTextNode($contaquecimentoagas);
                    $attribute1v->appendChild($attribute1Value);

                    // luz eletrica
                    $attribute = $dom->createElement("attribute");
                    $attributes->appendChild($attribute);

                    $attribute1n = $dom->createElement("name");
                    $attribute->appendChild($attribute1n);
                    $attribute1Name = $dom->createTextNode('Luz elétrica');
                    $attribute1n->appendChild($attribute1Name);

                    $attribute1v = $dom->createElement("value");
                    $attribute->appendChild($attribute1v);
                    $attribute1Value = $dom->createTextNode($contluzeletrica);
                    $attribute1v->appendChild($attribute1Value);

                    // casa de caseiro
                    $attribute = $dom->createElement("attribute");
                    $attributes->appendChild($attribute);

                    $attribute1n = $dom->createElement("name");
                    $attribute->appendChild($attribute1n);
                    $attribute1Name = $dom->createTextNode('Casa de caseiro');
                    $attribute1n->appendChild($attribute1Name);

                    $attribute1v = $dom->createElement("value");
                    $attribute->appendChild($attribute1v);
                    $attribute1Value = $dom->createTextNode($contcasadecaseiro);
                    $attribute1v->appendChild($attribute1Value);

                    // gerador
                    $attribute = $dom->createElement("attribute");
                    $attributes->appendChild($attribute);

                    $attribute1n = $dom->createElement("name");
                    $attribute->appendChild($attribute1n);
                    $attribute1Name = $dom->createTextNode('Gerador');
                    $attribute1n->appendChild($attribute1Name);

                    $attribute1v = $dom->createElement("value");
                    $attribute->appendChild($attribute1v);
                    $attribute1Value = $dom->createTextNode($contgerador);
                    $attribute1v->appendChild($attribute1Value);

                    // sede
                    $attribute = $dom->createElement("attribute");
                    $attributes->appendChild($attribute);

                    $attribute1n = $dom->createElement("name");
                    $attribute->appendChild($attribute1n);
                    $attribute1Name = $dom->createTextNode('Sede');
                    $attribute1n->appendChild($attribute1Name);

                    $attribute1v = $dom->createElement("value");
                    $attribute->appendChild($attribute1v);
                    $attribute1Value = $dom->createTextNode($contsede);
                    $attribute1v->appendChild($attribute1Value);

                    //// temporada
                    if ($campo['negocio'] == 'Temporada') {

                        // banheira
                        $attribute = $dom->createElement("attribute");
                        $attributes->appendChild($attribute);

                        $attribute1n = $dom->createElement("name");
                        $attribute->appendChild($attribute1n);
                        $attribute1Name = $dom->createTextNode('Banheira');
                        $attribute1n->appendChild($attribute1Name);

                        $attribute1v = $dom->createElement("value");
                        $attribute->appendChild($attribute1v);
                        $attribute1Value = $dom->createTextNode($contbanheira);
                        $attribute1v->appendChild($attribute1Value);

                        // fogao
                        $attribute = $dom->createElement("attribute");
                        $attributes->appendChild($attribute);

                        $attribute1n = $dom->createElement("name");
                        $attribute->appendChild($attribute1n);
                        $attribute1Name = $dom->createTextNode('Fogão');
                        $attribute1n->appendChild($attribute1Name);

                        $attribute1v = $dom->createElement("value");
                        $attribute->appendChild($attribute1v);
                        $attribute1Value = $dom->createTextNode($contfogao);
                        $attribute1v->appendChild($attribute1Value);

                        // geladeira
                        $attribute = $dom->createElement("attribute");
                        $attributes->appendChild($attribute);

                        $attribute1n = $dom->createElement("name");
                        $attribute->appendChild($attribute1n);
                        $attribute1Name = $dom->createTextNode('Geladeira');
                        $attribute1n->appendChild($attribute1Name);

                        $attribute1v = $dom->createElement("value");
                        $attribute->appendChild($attribute1v);
                        $attribute1Value = $dom->createTextNode($contgeladeira);
                        $attribute1v->appendChild($attribute1Value);
                    }
                }
                //////////////////////////////////////////////////////////


                if (($campo['tipo'] == 'Casa') || ($campo['tipo'] == 'Apartamento')) {
                    // Ar condicionado central
                    $attribute = $dom->createElement("attribute");
                    $attributes->appendChild($attribute);

                    $attribute1n = $dom->createElement("name");
                    $attribute->appendChild($attribute1n);
                    $attribute1Name = $dom->createTextNode('Ar condicionado central');
                    $attribute1n->appendChild($attribute1Name);

                    $attribute1v = $dom->createElement("value");
                    $attribute->appendChild($attribute1v);
                    $attribute1Value = $dom->createTextNode($contarcentral);
                    $attribute1v->appendChild($attribute1Value);

                    // children care
                    $attribute = $dom->createElement("attribute");
                    $attributes->appendChild($attribute);

                    $attribute1n = $dom->createElement("name");
                    $attribute->appendChild($attribute1n);
                    $attribute1Name = $dom->createTextNode('Children care');
                    $attribute1n->appendChild($attribute1Name);

                    $attribute1v = $dom->createElement("value");
                    $attribute->appendChild($attribute1v);
                    $attribute1Value = $dom->createTextNode($contchildrencare);
                    $attribute1v->appendChild($attribute1Value);

                    // escritorio
                    $attribute = $dom->createElement("attribute");
                    $attributes->appendChild($attribute);

                    $attribute1n = $dom->createElement("name");
                    $attribute->appendChild($attribute1n);
                    $attribute1Name = $dom->createTextNode('Escritório');
                    $attribute1n->appendChild($attribute1Name);

                    $attribute1v = $dom->createElement("value");
                    $attribute->appendChild($attribute1v);
                    $attribute1Value = $dom->createTextNode($contescritorio);
                    $attribute1v->appendChild($attribute1Value);

                    // depósito privativo
                    $attribute = $dom->createElement("attribute");
                    $attributes->appendChild($attribute);

                    $attribute1n = $dom->createElement("name");
                    $attribute->appendChild($attribute1n);
                    if ($campo['subtipoimovel'] != 'Flat') {
                        $nomeestacionamento = 'Estacionamento visitantes';
                    } else {
                        $nomeestacionamento = 'Estacionamento';
                    }
                    $attribute1Name = $dom->createTextNode($nomeestacionamento);
                    $attribute1n->appendChild($attribute1Name);

                    $attribute1v = $dom->createElement("value");
                    $attribute->appendChild($attribute1v);
                    $attribute1Value = $dom->createTextNode($contestacionamentovisitantes);
                    $attribute1v->appendChild($attribute1Value);


                    // jacuzzi
                    $attribute = $dom->createElement("attribute");
                    $attributes->appendChild($attribute);

                    $attribute1n = $dom->createElement("name");
                    $attribute->appendChild($attribute1n);
                    $attribute1Name = $dom->createTextNode('Jacuzzi');
                    $attribute1n->appendChild($attribute1Name);

                    $attribute1v = $dom->createElement("value");
                    $attribute->appendChild($attribute1v);
                    $attribute1Value = $dom->createTextNode($contjacuzzi);
                    $attribute1v->appendChild($attribute1Value);

                    // jardim
                    $attribute = $dom->createElement("attribute");
                    $attributes->appendChild($attribute);

                    $attribute1n = $dom->createElement("name");
                    $attribute->appendChild($attribute1n);
                    $attribute1Name = $dom->createTextNode('Jardim');
                    $attribute1n->appendChild($attribute1Name);

                    $attribute1v = $dom->createElement("value");
                    $attribute->appendChild($attribute1v);
                    $attribute1Value = $dom->createTextNode($contjardim);
                    $attribute1v->appendChild($attribute1Value);

                    // lavabo
                    $attribute = $dom->createElement("attribute");
                    $attributes->appendChild($attribute);

                    $attribute1n = $dom->createElement("name");
                    $attribute->appendChild($attribute1n);
                    $attribute1Name = $dom->createTextNode('Lavabo');
                    $attribute1n->appendChild($attribute1Name);

                    $attribute1v = $dom->createElement("value");
                    $attribute->appendChild($attribute1v);
                    $attribute1Value = $dom->createTextNode($contlavabo);
                    $attribute1v->appendChild($attribute1Value);

                    // playground
                    $attribute = $dom->createElement("attribute");
                    $attributes->appendChild($attribute);

                    $attribute1n = $dom->createElement("name");
                    $attribute->appendChild($attribute1n);
                    $attribute1Name = $dom->createTextNode('Playground');
                    $attribute1n->appendChild($attribute1Name);

                    $attribute1v = $dom->createElement("value");
                    $attribute->appendChild($attribute1v);
                    $attribute1Value = $dom->createTextNode($contplayground);
                    $attribute1v->appendChild($attribute1Value);

                    // quadra poliesportiva
                    $attribute = $dom->createElement("attribute");
                    $attributes->appendChild($attribute);

                    $attribute1n = $dom->createElement("name");
                    $attribute->appendChild($attribute1n);
                    if ($campo['subtipoimovel'] != 'Flat') {
                        $nomequadra = 'Quadra poliesportiva';
                    } else {
                        $nomequadra = 'Quadra esportiva';
                    }

                    $attribute1Name = $dom->createTextNode($nomequadra);
                    $attribute1n->appendChild($attribute1Name);

                    $attribute1v = $dom->createElement("value");
                    $attribute->appendChild($attribute1v);
                    $attribute1Value = $dom->createTextNode($contquadrapoliesportiva);
                    $attribute1v->appendChild($attribute1Value);

                    // sala de ginastica
                    $attribute = $dom->createElement("attribute");
                    $attributes->appendChild($attribute);

                    $attribute1n = $dom->createElement("name");
                    $attribute->appendChild($attribute1n);
                    $attribute1Name = $dom->createTextNode('Sala de ginástica');
                    $attribute1n->appendChild($attribute1Name);

                    $attribute1v = $dom->createElement("value");
                    $attribute->appendChild($attribute1v);
                    $attribute1Value = $dom->createTextNode($contsaladeginastiva);
                    $attribute1v->appendChild($attribute1Value);

                    // salao de festas
                    $attribute = $dom->createElement("attribute");
                    $attributes->appendChild($attribute);

                    $attribute1n = $dom->createElement("name");
                    $attribute->appendChild($attribute1n);
                    $attribute1Name = $dom->createTextNode('Salão de festas');
                    $attribute1n->appendChild($attribute1Name);

                    $attribute1v = $dom->createElement("value");
                    $attribute->appendChild($attribute1v);
                    $attribute1Value = $dom->createTextNode($contsalaodefestas);
                    $attribute1v->appendChild($attribute1Value);

                    // sauna/spa
                    $attribute = $dom->createElement("attribute");
                    $attributes->appendChild($attribute);

                    $attribute1n = $dom->createElement("name");
                    $attribute->appendChild($attribute1n);
                    $attribute1Name = $dom->createTextNode('Sauna/spa');
                    $attribute1n->appendChild($attribute1Name);

                    $attribute1v = $dom->createElement("value");
                    $attribute->appendChild($attribute1v);
                    $attribute1Value = $dom->createTextNode($contsaunaspa);
                    $attribute1v->appendChild($attribute1Value);

                    // tv a cabo
                    $attribute = $dom->createElement("attribute");
                    $attributes->appendChild($attribute);

                    $attribute1n = $dom->createElement("name");
                    $attribute->appendChild($attribute1n);
                    $attribute1Name = $dom->createTextNode('TV a cabo');
                    $attribute1n->appendChild($attribute1Name);

                    $attribute1v = $dom->createElement("value");
                    $attribute->appendChild($attribute1v);
                    $attribute1Value = $dom->createTextNode($conttvacabo);
                    $attribute1v->appendChild($attribute1Value);

                    if ($campo['subtipoimovel'] != 'Flat') {
                        /////////////////////////////////////////////// Itens abaixo não tem no Flat
                        // area de serviço
                        $attribute = $dom->createElement("attribute");
                        $attributes->appendChild($attribute);

                        $attribute1n = $dom->createElement("name");
                        $attribute->appendChild($attribute1n);
                        $attribute1Name = $dom->createTextNode('Área de Serviço');
                        $attribute1n->appendChild($attribute1Name);

                        $attribute1v = $dom->createElement("value");
                        $attribute->appendChild($attribute1v);
                        $attribute1Value = $dom->createTextNode($contareaservico);
                        $attribute1v->appendChild($attribute1Value);


                        // armarios embutidos
                        $attribute = $dom->createElement("attribute");
                        $attributes->appendChild($attribute);

                        $attribute1n = $dom->createElement("name");
                        $attribute->appendChild($attribute1n);
                        $attribute1Name = $dom->createTextNode('Armarios embutidos');
                        $attribute1n->appendChild($attribute1Name);

                        $attribute1v = $dom->createElement("value");
                        $attribute->appendChild($attribute1v);
                        $attribute1Value = $dom->createTextNode($contarmarioembutido);
                        $attribute1v->appendChild($attribute1Value);

                        // armarios embutidos
                        $attribute = $dom->createElement("attribute");
                        $attributes->appendChild($attribute);

                        $attribute1n = $dom->createElement("name");
                        $attribute->appendChild($attribute1n);
                        $attribute1Name = $dom->createTextNode('Biblioteca');
                        $attribute1n->appendChild($attribute1Name);

                        $attribute1v = $dom->createElement("value");
                        $attribute->appendChild($attribute1v);
                        $attribute1Value = $dom->createTextNode($contbiblioteca);
                        $attribute1v->appendChild($attribute1Value);

                        // campo de futebol
                        $attribute = $dom->createElement("attribute");
                        $attributes->appendChild($attribute);

                        $attribute1n = $dom->createElement("name");
                        $attribute->appendChild($attribute1n);
                        $attribute1Name = $dom->createTextNode('Campo de Futebol');
                        $attribute1n->appendChild($attribute1Name);

                        $attribute1v = $dom->createElement("value");
                        $attribute->appendChild($attribute1v);
                        $attribute1Value = $dom->createTextNode($contcampodefutebol);
                        $attribute1v->appendChild($attribute1Value);

                        // closet
                        $attribute = $dom->createElement("attribute");
                        $attributes->appendChild($attribute);

                        $attribute1n = $dom->createElement("name");
                        $attribute->appendChild($attribute1n);
                        $attribute1Name = $dom->createTextNode('Closet');
                        $attribute1n->appendChild($attribute1Name);

                        $attribute1v = $dom->createElement("value");
                        $attribute->appendChild($attribute1v);
                        $attribute1Value = $dom->createTextNode($contcloset);
                        $attribute1v->appendChild($attribute1Value);

                        // copa
                        $attribute = $dom->createElement("attribute");
                        $attributes->appendChild($attribute);

                        $attribute1n = $dom->createElement("name");
                        $attribute->appendChild($attribute1n);
                        $attribute1Name = $dom->createTextNode('Copa');
                        $attribute1n->appendChild($attribute1Name);

                        $attribute1v = $dom->createElement("value");
                        $attribute->appendChild($attribute1v);
                        $attribute1Value = $dom->createTextNode($contcopa);
                        $attribute1v->appendChild($attribute1Value);

                        // depósito privativo
                        $attribute = $dom->createElement("attribute");
                        $attributes->appendChild($attribute);

                        $attribute1n = $dom->createElement("name");
                        $attribute->appendChild($attribute1n);
                        $attribute1Name = $dom->createTextNode('Depósito privativo');
                        $attribute1n->appendChild($attribute1Name);

                        $attribute1v = $dom->createElement("value");
                        $attribute->appendChild($attribute1v);
                        $attribute1Value = $dom->createTextNode($contdepositoprivativo);
                        $attribute1v->appendChild($attribute1Value);

                        // elevador de serviço
                        $attribute = $dom->createElement("attribute");
                        $attributes->appendChild($attribute);

                        $attribute1n = $dom->createElement("name");
                        $attribute->appendChild($attribute1n);
                        $attribute1Name = $dom->createTextNode('Elevador de serviço');
                        $attribute1n->appendChild($attribute1Name);

                        $attribute1v = $dom->createElement("value");
                        $attribute->appendChild($attribute1v);
                        $attribute1Value = $dom->createTextNode($contelevadordeservico);
                        $attribute1v->appendChild($attribute1Value);

                        // internet
                        $attribute = $dom->createElement("attribute");
                        $attributes->appendChild($attribute);

                        $attribute1n = $dom->createElement("name");
                        $attribute->appendChild($attribute1n);
                        $attribute1Name = $dom->createTextNode('Internet');
                        $attribute1n->appendChild($attribute1Name);

                        $attribute1v = $dom->createElement("value");
                        $attribute->appendChild($attribute1v);
                        $attribute1Value = $dom->createTextNode($continternet);
                        $attribute1v->appendChild($attribute1Value);

                        // lareira
                        $attribute = $dom->createElement("attribute");
                        $attributes->appendChild($attribute);

                        $attribute1n = $dom->createElement("name");
                        $attribute->appendChild($attribute1n);
                        $attribute1Name = $dom->createTextNode('Lareira');
                        $attribute1n->appendChild($attribute1Name);

                        $attribute1v = $dom->createElement("value");
                        $attribute->appendChild($attribute1v);
                        $attribute1Value = $dom->createTextNode($contlareira);
                        $attribute1v->appendChild($attribute1Value);

                        // lavanderia coletiva
                        $attribute = $dom->createElement("attribute");
                        $attributes->appendChild($attribute);

                        $attribute1n = $dom->createElement("name");
                        $attribute->appendChild($attribute1n);
                        $attribute1Name = $dom->createTextNode('Lavanderia Coletiva');
                        $attribute1n->appendChild($attribute1Name);

                        $attribute1v = $dom->createElement("value");
                        $attribute->appendChild($attribute1v);
                        $attribute1Value = $dom->createTextNode($contlavanderiacoletiva);
                        $attribute1v->appendChild($attribute1Value);

                        // quadra de tenis
                        $attribute = $dom->createElement("attribute");
                        $attributes->appendChild($attribute);

                        $attribute1n = $dom->createElement("name");
                        $attribute->appendChild($attribute1n);
                        $attribute1Name = $dom->createTextNode('Quadra de tênis');
                        $attribute1n->appendChild($attribute1Name);

                        $attribute1v = $dom->createElement("value");
                        $attribute->appendChild($attribute1v);
                        $attribute1Value = $dom->createTextNode($contquadradetenis);
                        $attribute1v->appendChild($attribute1Value);

                        // quarto de empregada
                        $attribute = $dom->createElement("attribute");
                        $attributes->appendChild($attribute);

                        $attribute1n = $dom->createElement("name");
                        $attribute->appendChild($attribute1n);
                        $attribute1Name = $dom->createTextNode('Quarto/Banheiro de empregada');
                        $attribute1n->appendChild($attribute1Name);

                        $attribute1v = $dom->createElement("value");
                        $attribute->appendChild($attribute1v);
                        $attribute1Value = $dom->createTextNode($contquartoempregada);
                        $attribute1v->appendChild($attribute1Value);

                        // sala de estar
                        $attribute = $dom->createElement("attribute");
                        $attributes->appendChild($attribute);

                        $attribute1n = $dom->createElement("name");
                        $attribute->appendChild($attribute1n);
                        $attribute1Name = $dom->createTextNode('Sala de estar');
                        $attribute1n->appendChild($attribute1Name);

                        $attribute1v = $dom->createElement("value");
                        $attribute->appendChild($attribute1v);
                        $attribute1Value = $dom->createTextNode($contsaladeestar);
                        $attribute1v->appendChild($attribute1Value);

                        // sala de jantar
                        $attribute = $dom->createElement("attribute");
                        $attributes->appendChild($attribute);

                        $attribute1n = $dom->createElement("name");
                        $attribute->appendChild($attribute1n);
                        $attribute1Name = $dom->createTextNode('Sala de jantar');
                        $attribute1n->appendChild($attribute1Name);

                        $attribute1v = $dom->createElement("value");
                        $attribute->appendChild($attribute1v);
                        $attribute1Value = $dom->createTextNode($contsaladejantar);
                        $attribute1v->appendChild($attribute1Value);

                        // sala intima
                        $attribute = $dom->createElement("attribute");
                        $attributes->appendChild($attribute);

                        $attribute1n = $dom->createElement("name");
                        $attribute->appendChild($attribute1n);
                        $attribute1Name = $dom->createTextNode('Sala íntima');
                        $attribute1n->appendChild($attribute1Name);

                        $attribute1v = $dom->createElement("value");
                        $attribute->appendChild($attribute1v);
                        $attribute1Value = $dom->createTextNode($contsalaintima);
                        $attribute1v->appendChild($attribute1Value);

                        // salao de jogos
                        $attribute = $dom->createElement("attribute");
                        $attributes->appendChild($attribute);

                        $attribute1n = $dom->createElement("name");
                        $attribute->appendChild($attribute1n);
                        $attribute1Name = $dom->createTextNode('Salão de jogos');
                        $attribute1n->appendChild($attribute1Name);

                        $attribute1v = $dom->createElement("value");
                        $attribute->appendChild($attribute1v);
                        $attribute1Value = $dom->createTextNode($contsalaodejogos);
                        $attribute1v->appendChild($attribute1Value);

                        // segurança
                        $attribute = $dom->createElement("attribute");
                        $attributes->appendChild($attribute);

                        $attribute1n = $dom->createElement("name");
                        $attribute->appendChild($attribute1n);
                        $attribute1Name = $dom->createTextNode('Segurança');
                        $attribute1n->appendChild($attribute1Name);

                        $attribute1v = $dom->createElement("value");
                        $attribute->appendChild($attribute1v);
                        $attribute1Value = $dom->createTextNode($contsegurança);
                        $attribute1v->appendChild($attribute1Value);

                        // sauna
                        $attribute = $dom->createElement("attribute");
                        $attributes->appendChild($attribute);

                        $attribute1n = $dom->createElement("name");
                        $attribute->appendChild($attribute1n);
                        $attribute1Name = $dom->createTextNode('Sauna');
                        $attribute1n->appendChild($attribute1Name);

                        $attribute1v = $dom->createElement("value");
                        $attribute->appendChild($attribute1v);
                        $attribute1Value = $dom->createTextNode($contsauna);
                        $attribute1v->appendChild($attribute1Value);

                        // spa
                        $attribute = $dom->createElement("attribute");
                        $attributes->appendChild($attribute);

                        $attribute1n = $dom->createElement("name");
                        $attribute->appendChild($attribute1n);
                        $attribute1Name = $dom->createTextNode('Spa');
                        $attribute1n->appendChild($attribute1Name);

                        $attribute1v = $dom->createElement("value");
                        $attribute->appendChild($attribute1v);
                        $attribute1Value = $dom->createTextNode($contspa);
                        $attribute1v->appendChild($attribute1Value);

                        // terraço
                        $attribute = $dom->createElement("attribute");
                        $attributes->appendChild($attribute);

                        $attribute1n = $dom->createElement("name");
                        $attribute->appendChild($attribute1n);
                        $attribute1Name = $dom->createTextNode('Terraço');
                        $attribute1n->appendChild($attribute1Name);

                        $attribute1v = $dom->createElement("value");
                        $attribute->appendChild($attribute1v);
                        $attribute1Value = $dom->createTextNode($contterraco);
                        $attribute1v->appendChild($attribute1Value);


                        if ($campo['tipo'] == 'Casa') {

                            // sotão
                            $attribute = $dom->createElement("attribute");
                            $attributes->appendChild($attribute);

                            $attribute1n = $dom->createElement("name");
                            $attribute->appendChild($attribute1n);
                            $attribute1Name = $dom->createTextNode('Sotão');
                            $attribute1n->appendChild($attribute1Name);

                            $attribute1v = $dom->createElement("value");
                            $attribute->appendChild($attribute1v);
                            $attribute1Value = $dom->createTextNode($contsotao);
                            $attribute1v->appendChild($attribute1Value);

                            // quintal
                            $attribute = $dom->createElement("attribute");
                            $attributes->appendChild($attribute);

                            $attribute1n = $dom->createElement("name");
                            $attribute->appendChild($attribute1n);
                            $attribute1Name = $dom->createTextNode('Quintal');
                            $attribute1n->appendChild($attribute1Name);

                            $attribute1v = $dom->createElement("value");
                            $attribute->appendChild($attribute1v);
                            $attribute1Value = $dom->createTextNode($contquintal);
                            $attribute1v->appendChild($attribute1Value);

                            // alarme
                            $attribute = $dom->createElement("attribute");
                            $attributes->appendChild($attribute);

                            $attribute1n = $dom->createElement("name");
                            $attribute->appendChild($attribute1n);
                            $attribute1Name = $dom->createTextNode('Alarme');
                            $attribute1n->appendChild($attribute1Name);

                            $attribute1v = $dom->createElement("value");
                            $attribute->appendChild($attribute1v);
                            $attribute1Value = $dom->createTextNode($contalarme);
                            $attribute1v->appendChild($attribute1Value);
                        }
                    }
                }
            }
/*
            if ($campo['descricaodoimovel'] != null) {
                $attributes = $dom->createElement("description");
                $imovel->appendChild($attributes);
                $attributesValue = $dom->createTextNode($campo['descricaodoimovel']);
                $attributes->appendChild($attributesValue);
            }

            
            $detalhes = unserialize($campo['caracteristicas']);
            $proximidades = unserialize($campo['proximidades']);
            $adddetalhes = '';
            $addproximidades = '';
            
            foreach ($detalhes as $detalhe) {
                
                if($adddetalhes!=''){ $adddetalhes = $adddetalhes.', '; }
                $buscaDetalhe = $this->acaoglobal(array('detalhes', 'id'), 'get', $detalhe);
                $nomeDetalhe = $buscaDetalhe['nome'];
                $adddetalhes = $adddetalhes.$nomeDetalhe;
                
            }
            
            foreach ($proximidades as $proximidade) {

                if($addproximidades!=''){ $addproximidades = $addproximidades.', '; }
                $buscaProximidades = $this->acaoglobal(array('proximidades', 'id'), 'get', $proximidade);
                $nomeProximidade = $buscaProximidades['nome'];
                $addproximidades = $addproximidades.$nomeProximidade;

            }
            */
            $Category = $dom->createElement("description");
            $imovel->appendChild($Category);
            $descricaofinal = $campo['descricaodoimovel_mercadolivre'];
            $CategoryValue = $dom->createCDATASection($descricaofinal);
            $Category->appendChild($CategoryValue);
            
            //}
            /*
              if($campo['andar']!=null){
              // valor do iptu
              $attribute = $dom->createElement("attribute");
              $attributes->appendChild($attribute);

              $attribute1n = $dom->createElement("name");
              $attribute->appendChild($attribute1n);
              $attribute1Name = $dom->createTextNode('Andar');
              $attribute1n->appendChild($attribute1Name);

              $attribute1v = $dom->createElement("value");
              $attribute->appendChild($attribute1v);
              $attribute1Value = $dom->createTextNode($campo['andar']);
              $attribute1v->appendChild($attribute1Value);
              }
             */
            //// attributes - fim
            //}
        }
        
    }else{      
        
        if($fone1 == ''){
            $imovel_invalido_mercado .= 'Telefone '.'%';
        }        
        if($ddd1 == ''){
            $imovel_invalido_mercado .= 'DDD Telefone '.'%';
        } 
        if($campo['valor'] == ''){
            $imovel_invalido_mercado .= 'Valor do Imóvel '.'%';
        }
        if($campo['cep_estado'] == null){
            $imovel_invalido_mercado .= 'Endereço: CEP'.'%';
        }
        if($campo['cep_cidade'] == null){
            $imovel_invalido_mercado .= 'Endereço: cidade'.'%';
        }
        if($campo['cep_bairro'] == null){
            $imovel_invalido_mercado .= 'Endereço: bairro'.'%';
        }     
        if($campo['cep_numero'] == null){
            $imovel_invalido_mercado .= 'Endereço: número'.'%';
        }
        if (($campo['subtipoimovel'] == 'Chácara') || ($campo['subtipoimovel'] == 'Fazenda') || ($campo['subtipoimovel'] == 'Sítio')) {
            if ($campo['areatotal_medida'] != 'ha') {
                $imovel_invalido_mercado .= 'Área Total Inválida'.'%';
            }
        }        
        if (($campo['tipo'] == 'Apartamento') || ($campo['tipo'] == 'Casa')) {
            if (($campo['dormitorio'] == null)) {
                $imovel_invalido_mercado .= 'Dormitório'.'%';
            }
            if (($campo['banheiro'] == null)) {
                $imovel_invalido_mercado .= 'Banheiro'.'%';
            } 
        }
        if (($campo['tipo'] == 'Apartamento') || ($campo['tipo'] == 'Casa')) {
            if (($campo['dormitorio'] == '0')) {
                $imovel_invalido_mercado .= 'Dormitório'.'%';
            }
            if (($campo['banheiro'] == null)) {
                $imovel_invalido_mercado .= 'Banheiro'.'%';
            }
        }
        if ($campo['tipo'] == 'Comercial') {
            if ($campo['banheiro'] == null) {
                $imovel_invalido_mercado .= 'Banheiro'.'%';
            }
        }
        if ($campo['tipo'] == 'Comercial') {
            if ($campo['banheiro'] == '0') {
                $imovel_invalido_mercado .= 'Banheiro'.'%';
            }
        }        
        if($campo['status'] != '0'){
            $imovel_invalido_mercado .= 'Status do Imóvel: Arquivado'.'%';
        }        
    }
    
    if(($validar == '1') || ($imovelvalido == 'nao')){                
        $cod_referencia_pendente_mercadolivre .=   '-' .$campo['id_imovel'];                
    }
}
    if($imovel_invalido_mercado != ''){ 
        $imovel_invalido_id_mercado .= $campo['id_imovel'].'%'.$imovel_invalido_mercado.'//';
    }
}
$get_integracoes = $this->acaoglobal(array('integracoes', 'id'), 'get', 8);    
    
//                $get_integracoes = explode('-', $get_integracoes['pendentes']);  
//                $get_integracoes = array_unique($get_integracoes);
//                
//                foreach ($get_integracoes as $get_integracoes) {
//                         $get_integra.= $get_integracoes;
//                          //$get_integra.= '-';
//                }

$this->acaoglobal(array('integracoes', 'id'), 'update', array(
                                                    'pendentes' => $cod_referencia_pendente_mercadolivre,
                                                    'pendencias' => $imovel_invalido_id_mercado,
                                                    'id' => '8'
                                                        )
                                                );

$prod_dom_load = $banco->query('SELECT * FROM produtos WHERE id_cliente = "' . $_SESSION['userdata']['contratante'] . '" AND produto_servico < 6');
$prod_dom = $prod_dom_load->fetch(PDO::FETCH_ASSOC);

$prod_dom_info_load = $banco->query('SELECT * FROM produtos WHERE dominio = "' . $prod_dom['dominio'] . '" AND produto_servico = 8');
$prod_dom_info = $prod_dom_info_load->fetch(PDO::FETCH_ASSOC);

$serv_info_load = $banco->query('SELECT * FROM servidores WHERE id_servidores = 2');
$serv_info = $serv_info_load->fetch(PDO::FETCH_ASSOC);

$prod_info = unserialize($prod_dom_info['dados_cpanel']);
//final do imovel
// save tree to file
$dom->save(ABSPATH . "/subdominios/" . $_SESSION['userdata']['contratante'] . "/mercadolivre.xml");
// save tree to string
$order = $dom->save(ABSPATH . "/subdominios/" . $_SESSION['userdata']['contratante'] . "/mercadolivre.xml");


$file = ABSPATH . "/subdominios/" . $_SESSION['userdata']['contratante'] . "/mercadolivre.xml";

// set up basic connection
$conn_id = ftp_connect($serv_info['ip_server']);
$dir = 'public_html/integracoes';
$remote_file = $dir.'/mercadolivre.xml';
// login with username and password
$login_result = ftp_login($conn_id, $prod_info['user'], $prod_info['senha']);
// upload a file

if (@ftp_mkdir($conn_id, $dir)) {
    echo "successfully created $dir\n";
} else {
    echo "There was a problem while creating $dir\n";
}
    if (ftp_put($conn_id, $remote_file, $file, FTP_ASCII)) {
        echo "successfully uploaded $file\n";
    } else {
        echo "There was a problem while uploading $file\n";
    }



// close the connection
unlink($file);
ftp_close($conn_id);
?>

Youez - 2016 - github.com/yon3zu
LinuXploit