set_time_limit(15);
$dbs = db_qa("show databases");
foreach($dbs as $db){
$db = $db['Database'];
// if(!mysql_tnx_select_db($db)) echo "mysql_tnx_select_db ".$db.": ".mysql_tnx_error()."
";
// else{
if(!db_qrs("show tables like 'newsletters'", 0, $db) || !db_qrs("show tables like 'mails'", 0, $db)) continue;
$echo = "
".$db."
";
$tot = db_qrs("select count(*) from mails where sent is not null", 0, $db);
$tot_anno = db_qrs("select count(*) from mails where sent > now() - interval 1 year", 0, $db);
if(!$tot) continue;
$last = db_qrs("select max(data_invio) from newsletters", 0, $db);
$echo .= "ULTIMO INVIO:\t\t".$last."
";
$echo .= "IN ATTESA DI INVIO:\t\t".db_qrs("select count(*) from mails where sent is null", 0, $db)."
";
$echo .= "MAIL INVIATE ULTIMO ANNO:\t\t$tot_anno "." (".ceil($tot_anno/365)." mail/giorno)
";//le email vecchie vengono cancellate
$echo .= "MAIL INVIATE DA SEMPRE:\t\t$tot
";//le email vecchie vengono cancellate
$echo .= "TOTALE NEWSLETTER INVIATE:\t\t".db_qrs("select count(*) from newsletters where data_invio != '0000-00-00 00:00:00'", 0, $db)."
";
$echo .= "UTENTI MAX INVIO:\t\t".db_qrs("select count(*) as tot from mails group by newsletter_id order by tot desc limit 1", 0, $db);
$k = $tot_anno ? $tot_anno : 0;
while($return_most[$k]) $k++;//evito di perdere un altro utente con lo stesso numero di newsletter
$return_most[$k] = $echo;
$k = strtotime($last) ? strtotime($last) : 0;
while($return_recent[$k]) $k++;//evito di perdere un altro utente con lo stesso istante di ultimo invio :)
$return_recent[$k] = $echo;
// }
}
ksort($return_recent);
$return_recent = array_reverse($return_recent);
ksort($return_most);
$return_most = array_reverse($return_most);
?>
Per ultimo invio:
|
Per numero di invii ultimo anno:
|