1<?php
2
3require_once dirname(__FILE__).'/accesscheck.php';
4
5ob_end_flush();
6$limit = ' limit 100';
7$numperrun = 500;
8$bouncerules = loadBounceRules();
9
10$req = Sql_Fetch_Row_query(sprintf('select count(*) from %s  where comment != "not processed"',
11    $GLOBALS['tables']['bounce']));
12$total = $req[0];
13if (isset($_GET['s'])) {
14    $s = sprintf('%d', $_GET['s']);
15    $e = $s + $numperrun;
16} else {
17    $s = 0;
18    $e = $numperrun;
19}
20$limit = ' limit '.$s.', '.$numperrun;
21
22if ($total > $numperrun && $e < $total) {
23    $next = '<p class="button">'.PageLink2('checkbouncerules&s='.$e,
24            sprintf($GLOBALS['I18N']->get('Process Next %d'), $numperrun)).'</p>';
25} else {
26    $next = '';
27}
28
29$unmatched = 0;
30$matched = 0;
31$req = Sql_Query(sprintf('select * from %s where comment != "not processed" %s', $GLOBALS['tables']['bounce'], $limit));
32while ($row = Sql_Fetch_Array($req)) {
33    $action = matchBounceRules($row['header']."\n\n".$row['data'], $bouncerules);
34    if ($action) {
35        //  print $row['comment']. " Match: $action<br/>";
36        ++$matched;
37    } else {
38        ++$unmatched;
39        echo $GLOBALS['I18N']->get('No match').': '.$row['id'].' '.PageLink2('bounce&amp;id='.$row['id'],
40                $row['comment']).'<br/>';
41    }
42    flush();
43}
44
45echo '<br/>'.$unmatched.' '.$GLOBALS['I18N']->get('bounces did not match any current active rule');
46echo '<br/>'.$matched.' '.$GLOBALS['I18N']->get('bounce matched current active rules');
47echo $next;
48