
DanielPoaRS
Membros-
Total de itens
2 -
Registro em
-
Última visita
Sobre DanielPoaRS

- Data de Nascimento 03/11/1972
Perfil
-
Gender
Male
-
Location
Porto Alegre-RS
DanielPoaRS's Achievements
0
Reputação
-
Bom dia Pessoal: Sou iniciante em PHP e estou enfrentando um problema. Eu tenho um FEED XML e queria ler ele com PHP, montar uma newsletter e enviar por e-mail. Porém no FEED tem 5 itens mas na hora de montar o newsletter ele monta um para cada item, ou seja, o cliente recebe 5 emails ao invés de apenas 1 contendo todos os cinco itens. Abaixo segue o código que estou utilizando: <?php date_default_timezone_set('America/Sao_Paulo'); $dia = date('Y-m-d H:i:s'); $datanova = strtotime($dia); $hostname_conn = "localhost"; $database_conn = "xxxxxxxxx"; $username_conn = "xxxxxxxxxxxxx"; $password_conn = "xxxxxxxxxxxxxx"; // Conectamos ao nosso servidor MySQL if(!($conn = mysql_connect($hostname_conn,$username_conn,$password_conn))) { echo "Erro ao conectar ao MySQL."; exit; } // Selecionamos nossa base de dados MySQL if(!($con = mysql_select_db($database_conn,$conn))) { echo "Erro ao selecionar ao MySQL."; exit; } $feed = simplexml_load_file('portoalegre.xml'); foreach($feed->channel->item as $item){ $id = $item->id; $titulo = utf8_decode($item->title); $link = $item ->link; $valornormal = $item->valornormal; $valordesconto = $item->valordesconto; $desconto = $item->desconto; $economia = $item->economia; $datainicio = $item->datainicio; $datafim = $item->datafim; $parceiro = utf8_decode($item->parceiro); $cidade = $item->cidade; $imagem = $item->imagem; $dataextenso = $item->dataextenso; $logoafiliado = $item->logoafiliado; $idcidade = $item->idcidade; $mensagem1 ="<html> <body bgcolor='#FFFFFF'> <div align='center'> <table width='600' border='0'> <tr> <td align='center' width='600'> <table width='600' align='center' border='0' cellspacing='10'> <tr> <td align='center'><font face='Arial' color='#666666'> <span style='font-size: 8pt'>Caso não consiga visualizar este e-mail por favor acesse nosso site<font color='#666666'> <a href='http://www.reuneofertas.com.br/' style='text-decoration: none'> <font color='#666666'>www.reuneofertas.com.br</font></a></font></span></font><table width='100%' border='0' style='border:10px solid #BCE38C;' bordercolor='#027B9D' bgcolor='#FFFFFF'> <tr> <td style='border-bottom:1px solid #91CE4B; padding-top:0; padding-bottom:0px; border-right-color:#CBCACA; border-right-width:1px; border-top-color:#CBCACA; border-top-width:1px'> <table width='100%' border='0' align='center' id='table16'> <tr> <td width='67%'> <a href='http://www.reuneofertas.com.br' target='_blank' title='Reúne Ofertas - Agregador de Ofertas Diárias!'> <img src='http://www.reuneofertas.com.br/images/logo.gif' style='border: 0px none;' style='display:block' alt='Reúne Ofertas - Agregador de Ofertas Diárias!' width='290' height='79'></a> </td> <td style='color:#000000; font-size: 12px; font-weight: bold; text-align: center' width='29%' bordercolor='#91CE4B'> <font color='#027B9D' face='Arial' style='font-size: 11pt'> <font face='Arial' style='font-size: 9pt; font-weight: 700' color='#666666'>Siga-nos:</font><font color='#666666' face='Arial' style='font-size: 11pt'><br> </font> <font color='#1C8FB0' face='Arial' style='font-size: 11pt'> <a target='_blank' href='http://www.facebook.com/pages/Reune-Ofertas/173688512703651'> <img border='0' src='http://localhost/reuneofertas/themes/green/images/facebook.png' width='32' height='32'></a> <a target='_blank' href='http://twitter.com/ReuneOfertas'> <img border='0' src='http://localhost/reuneofertas/themes/green/images/twitter.png' width='32' height='32'></a> <a target='_blank' href='http://www.orkut.com.br/Main#Community?cmm=116960235'><img border='0' src='http://localhost/reuneofertas/images/orkut.jpg' width='32' height='32'></a></font><br> <b> <font style='FONT-SIZE: 13pt' face='Arial Narrow'> <a href='https://plus.google.com/i/Z4GN26gPJVw:6JWGojXLeoc'> <img border='0' src='http://www.reuneofertas.com.br/themes/green/images/seguirgooglebuzz.bmp' width='179' height='28' style='display:block'></a></font><font face='Arial' style='font-size: 9pt'> </font></b> </font></td> </tr> <tr> <td colspan='2'> <table border='0' width='100%' id='table17' style='border-collapse: collapse'> <tr> <td width='397'> <font face='Arial Narrow' color='#1C8FB0'> <span style='font-size: 15pt; font-weight:700'>Ofertas do Dia - $cidade </span></font></td> <td align='right'> <span style='font-size: 11pt; font-weight:700'> <font face='Arial Narrow' color='#1C8FB0'> $dataextenso</font></td> </tr> </table></td> </tr> </table></td> </tr> <tr> <td> <table width='100%' cellspacing='0' border='0' style='border-bottom:2px #A5A4A4;padding-bottom:10px'> <tr> <tr> <td valign='top' width='175px' align='center' style='border-bottom:1px solid #91CE4B; border-left-width:1px; border-right-width:1px; border-top-width:1px; '> <a href='$link' target='_blank'><br> <img src='$imagem' style='border:1px solid #91CE4B;padding:5px;' width='165' border='0' height='130' style='display:block' /> </a></td> <td valign='top' width='233' style='border-bottom:1px solid #91CE4B; '> <table width='219' border='0' height='123'> <tr> <td> <p align='padrão' style='margin-left: 2px; margin-right: 2px'> <font color='#1C8FB0'><br> </font> <a href=' $link' style='color:#1C8FB0;letter-spacing:-0.5px;text-decoration:none; font-style:normal; font-variant:normal; font-weight:bold; font-size:15px; font-family:arial'> $titulo</a><font color='#1C8FB0'> </font> </td> </tr> <tr> <td> <table width='100%' border='0' cellpadding='3' cellspacing='0'> <tr> <td valign='top' style='font:bold 12px arial;color:#333;' align='left' colspan='3'> <p align='center'> <span style='font-size: 9pt'>Gostou? Compartilhe com seus Amigos nas Redes Sociais:</span></p> </td> </tr> <tr> <td valign='top' width='33%' style='font:bold 12px arial;color:#91CE4B;' align='left'> <p align='right'> <a href='https://www.facebook.com/sharer.php?u=$link&t=Oferta do Dia: $titulo' target='_blank' title='Facebook'> <span style='text-decoration: none; font-weight: 400'> <img src='http://www.reuneofertas.com.br/themes/green/images/facebook.png' width='40' height='32' border='0' /></span> </a></p></td> <td width='23%' align='left'> <p align='center'> <a href='http://twitter.com/?status=$titulo$link' target='_blank' title='Twitter'> <span style='text-decoration: none'> <img src='http://www.reuneofertas.com.br/themes/green/images/twitter.png' width='40' height='32' border='0' /></span> </a></p></td> <td width='36%'> <p align='left'> <a href='http://promote.orkut.com/preview?nt=orkut.com&tt=Oferta do Dia:&du=$link&cn=$titulo$link&tn=$imagem' target='_blank' title='Orkut'> <span style='text-decoration: none'> <img src='http://www.reuneofertas.com.br/themes/green/images/orkut.png' width='40' height='32' border='0' /></span> </a></p></td> </tr> </table></td> </tr> </table></td> <td valign='top' style='border-left:1px dashed #BCE38C; border-bottom:1px solid #91CE4B; '> <table width='100%' border='0'> <tr> <td> <table width='100%' border='0'> <tr><br> <td width='49%' align='center' style='font:bold 14px Arial, Helvetica, sans-serif;color:#000;'> <font style='font-size: 14pt' color='#1C8FB0'> R$$valornormal </font></td> <td valign='top' width='47%' align='left'> <a href=' $link' target='_blank'> <img src='../mala/buy_img_email.png' border='0' width='99' height='40' style='display:block'/> </a></td> </tr> </table></td> </tr> <tr> <td> <table width='100%' border='0'> <tr> <td align='center' width='83'> <table width='100%' border='0'> <tr> <td style='font:bold 11px Arial, Helvetica, sans-serif;color:#333333;text-align:center;'> <font style='font-size: 9pt' color='#666666'>VALOR</font></td> </tr> <tr> <td style='font:bold 12px Arial, Helvetica, sans-serif;color:#1C8FB0;text-align:center;'> <font style='font-size: 9pt' color='#027B9D'> R$$valordesconto </font></td> </tr> </table></td> <td align='center' width='70'> <table width='100%' border='0'> <tr> <td style='font:bold 11px Arial, Helvetica, sans-serif;color:#333333;text-align:center;'> <font style='font-size: 9pt' color='#666666'>DESCONTO</font><font style='font-size: 9pt' color='#027B9D'> </font></td> </tr> <tr> <td style='font:bold 12px Arial, Helvetica, sans-serif;color:#1C8FB0;text-align:center;'> <font style='font-size: 9pt' color='#027B9D'> $desconto% </font></td> </tr> </table></td> <td align='center' width='50px'> <table width='100%' border='0'> <tr> <td style='font:bold 11px Arial, Helvetica, sans-serif;color:#333333;text-align:center;'> <font style='font-size: 9pt' color='#666666'>ECONOMIA</font></td> </tr> <tr> <td style='font:bold 12px Arial, Helvetica, sans-serif;color:#1C8FB0;text-align:center;'> <font style='font-size: 9pt' color='#027B9D'> R$$economia </font></td> </tr> </table></td> </tr> </table></td> </tr> </table> <table width='100%' border='0' id='table2'> <tr> <td width='85%' align='left' style='font:normal 12px arial;color:#333333;'> <p align='center'><b>Fonte</b><font style='font:bold 11px arial;color:#333333;'><br> <img border='0' src='$logoafiliado' width='193' height='54' style='display:block'><br> </font> <img border='0' src='http://www.reuneofertas.com.br/images/linha.png' width='216' height='5'><font style='font:bold 11px arial;color:#333333;'> </font></p></td> </tr> </table> </td> </tr> </table></td> </tr> </table></td> </tr> </table></td> <td align='center' width='600'><hr></td> </tr> </table></div> <div align='center'> <table style='padding-top:10px;width:672px; margin-left:0px' cellpadding='0' cellspacing='0' border='0'> <tr> <td style='background-position: 0% 0%; padding-center: 5px;width:672px !important;background-image:none; background-repeat:repeat; background-attachment:scroll' align='center' bordercolor='#FFFFFF'> <table style='FONT-FAMILY: Arial, Helvetica, sans-serif; COLOR: #666; FONT-SIZE: 10px' border='0' cellspacing='0' cellpadding='0' width='94%' align='center' id='table3'> <tr> <td valign='top' align='left'> <img alt='' src='../mala/ob1.gif' width='23' height='15'></td> <td style='FONT-FAMILY: Arial, Helvetica, sans-serif' align='justify'> <font face='Arial Narrow'><b><span style='font-size: 10pt'>Porque você recebeu esse e-mail?</span></b><span style='font-size: 10pt'><br> Este e-mail foi enviado pelo Reúne Ofertas porque você possui cadastro conosco ou em algum site parceiro, juntamente com a permissão para contatá-lo. Para que futuras ofertas do Reúne Ofertas sejam entregues na sua caixa de entrada e não sejam tratadas como spam, por favor adicione <a href='mailto:ofertas@reuneofertas.com.br'> <font color='#098600'>ofertas@reuneofertas.com.br</font></a> a sua lista de contatos ou lista de remetentes aprovados.<br> </span></font></td> </tr> <tr> <td valign='top' align='left'> <img alt='' src='../mala/ob2.gif' width='23' height='15'></td> <td align='justify'><font face='Arial Narrow'><b> <font size='2'>Política de Privacidade</font></b><span style='font-size: 10pt'><br> Nós queremos que você se sinta confiante sobre a privacidade de suas informações pessoais, assim como todas as informações que temos sobre você estão protegidas pela nossa <a href='http://www.reuneofertas.com.br/privacidade.php'> <font color='#098600'>política de privacidade</font></a>.<br> </span></font></td> </tr> <tr> <td valign='top' align='left'> <img alt='' src='../mala/ob3.gif' width='23' height='15'></td> <td style='FONT-FAMILY: Arial, Helvetica, sans-serif' align='justify'> <font face='Arial Narrow'><b><span style='font-size: 10pt'>Deixar de Assinar </span></b></font><span style='font-size: 10pt'> <font face='Arial Narrow'><br> Vamos ficar tristes se deixar de assinar. Mas se você não quiser mais receber ofertas por e-mail do Reúne Ofertas, </font>"; //BUSCA OS EMAILS $q2 = mysql_query("SELECT * FROM tabela_xxx WHERE suscribe_status='1' AND city_id='$idcidade' AND enviada='0'"); while($linha=mysql_fetch_array($q2)){ $email = $linha['email_address']; $emailid = $linha['email_id']; $sair = md5($emailid."-".$email); $myLink = "http://www.reuneofertas.com.br/welcome/unsubscribe/".$emailid."/".$sair; $mensagem2="<a href='$myLink' target='_blank' style='color:#098600;' title='Descadastrar'> basta acessar a página de exclusão por aqui.</font></a><font face='Arial Narrow'><br> <br> </font></span></td> </tr> </table> </td> </tr> </table> </div> </body> </html>"; $texto = $mensagem1."".$mensagem2; } echo $texto; } ?> O que eu preciso é pegar os dados do FEED, montar uma newsletter (e não cinco) com todos os itens e enviar por e-mail para os clientes cadastrados em meu site. A parte para enviar eu utilizo o PHPMailer mas não coloquei no código acima pois o problema é de fato montar apenas uma Newsletter ao invés de 5. Alguém poderia me ajudar?
-
Bom dia Pessoal: Estou montando um sistema de Afiliados e gostaria que me ajudassem no que se refere a comissão até o 5º nível. Já fiz a parte de indicação onde o sistema guarda a ID e o NOME da pessoa que indicou. Agora preciso distribuir a comissão até o 5º nível de indicação. É o seguinte: sempre que um Afiliado efetua o pagamento da mensalidade 5 níveis acima dele devem ser comissionados, ou seja, cada um receberá um porcentagem sobre a mensalidade paga. Não sei como fazer isso em php. Poderiam me ajudar? Estou usando PHP com Mysql. Agradeço desde já. Bom dia para todos! Daniel.