-
Notifications
You must be signed in to change notification settings - Fork 0
/
list.php
31 lines (24 loc) · 1.26 KB
/
list.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<h2>Statistics for <?=$_POST['domain'] ?: 'all domains'?></h2>
<?php
$conf = parse_ini_file("opendmarc-report-analyzer.conf", true);
require_once('function.php');
/* Register POST valiable */
$dom = $_POST['domain'];
$policy = $_POST['policy'];
/* And now define the query */
$WHERE_POL = NULL;
$WHERE_DOM = NULL;
$LIMIT = NULL;
if ($dom) $WHERE_DOM = "`name` = '$dom' AND ";
if ($policy!='ALL') $WHERE_POL = "`policy` = $policy AND ";
if ($_POST['limit'] != 0) $LIMIT = 'LIMIT '.$_POST['limit'];
$query_dom = "SELECT `from_domain`, `name`, COUNT(`policy`) AS countp, `policy` FROM `messages` INNER JOIN domains ON domains.id=messages.`from_domain` WHERE $WHERE_DOM $WHERE_POL `date` >= DATE_SUB(NOW(), INTERVAL ".$conf['db']['INTERVAL'].") GROUP BY name,policy ORDER by countp DESC $LIMIT";
openlog($conf['syslog']['tag'], LOG_PID, $conf['syslog']['fac']);
$user = username();
$mysqli = mysql_conn ($conf['db']['HOST'], $conf['db']['USER'], $conf['db']['PASS'], $conf['db']['NAME'], $conf['db']['PORT'],$user);
report($mysqli,$query_dom,$LIMIT,'DMARC Domains from messages of last '.$conf['db']['INTERVAL'].' until now.');
$mysqli->close();
closelog();
?>
<div ID="Result"></div>
<p>Keep in mind that the <i>policy</i> is not the published policy, but the <b>enforced</b> policy.</p>