← Back
Editing: newsletter_elenco.php
<?php ###___###___###___###___###___###___###___###___###___###___###___###___### ### made with SmaDIB: Smart Database Interface Builder 0.4.0 ### ### by Smartmedia 2000 http://www.smartmedia2000.it/ ### ### info email: smadib@smartmedia2000.it ### ###___###___###___###___###____###____###____###___###___###___###___### require_once ("../funct.php"); require_once ("sess.php"); require_once ("conn.php"); require_once ("testacoda.php"); require_once ($dominio."/param_b.php"); $query = new doQuery(); $utNewsInt = array (999, 23); # utnti che usano la newsletter direttamente con le email degli intestateari nel sistema header('Content-Type: text/csv; charset=utf-8'); header('Content-Disposition: attachment; filename=email.csv'); $output = fopen('php://output', 'w'); fputcsv($output, array('Email', 'Cognome', 'Nome')); if (in_array ($id_utente, $utNewsInt)) $sql = "SELECT DISTINCT `email`, `cognome`, `nome` FROM `persone` WHERE `id_utente` = ".$id_utente." AND `tipo` < 3 AND `email` LIKE '%@%' GROUP BY `email` ORDER BY `cognome`, `nome`"; else $sql = "SELECT DISTINCT `email`, `cognome`, `nome` FROM `newsletter` WHERE `id_utente` = ".$id_utente." AND `email` LIKE '%@%' GROUP BY `email` ORDER BY `cognome`, `nome`"; $rows = $query->freeQuery ($sql, 2); foreach ($rows as $i=>$row) fputcsv ($output, $row); //$elenco.= "'".$row->email."','".$row->cognome." ".$row->nome."'\n<br>"; ?>
Save File
Cancel