<?php
include_once '../../../../tools/inc.php';
include '../../../common.php';
include '../tools/class.XMLCreator.php';
include "../tools/class.bounced.php";
include "../tools/class.pop3.php";
include "../tools/class.stat.php";
include "../tools/function.sql.php";

$table='newsletters'.$config["table_prefix"];
$table_pop3='pop3_accounts'.$config["table_prefix"];
$n_id=intval($n_id);
$position=intval($position);
$error=false;

$sql="select p.* from $table n 
left join $table_pop3 p on n.pop3=p.id
where n.id='$n_id'";
list($account)=$db->select($sql);

if (isset($account['id'])) {
	$b=new Bounced();
	$count=$b->check($account, 1+$position, 1);
}
$db->close();

$xml=new XMLCreator();
$xml->openTag('response');
if (!$count) $xml->addTag('error', 'true');
$xml->addTag('count', $count);
$xml->closeTag('response');
$xml->output();
exit;
?>