-
Notifications
You must be signed in to change notification settings - Fork 1
/
result.php
47 lines (43 loc) · 1.69 KB
/
result.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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
require_once('function.php');
require_once('linkify.php');
$pslist=parse_ini_file('dnsbl.conf', TRUE);
$items=readList($pslist['lists']['list']);
$ip = $_POST['ip'];
$result = checkList($ip, $items);
if ( empty($result) ) {
print "<p>The IP <b>$ip</b> is not listed.</p>";
exit();
}
$status = 'Not listed';
$listtype = NULL;
if ( $result['score'] >= $pslist['threshold']['bl'] ) {
$listtype = 'statusListed';
$status = 'This ip is currently blocklisted';
}
if ( $result['score'] <= $pslist['threshold']['wl'] ) {
$listtype = 'statusWhiteListed';
$status = 'This ip is currently whitelisted';
}
$title = "Listing result for <b>$ip</b>";
$content = array('List Name','Values','Scores','Score','Reason');
$fcontent = sprintf('<div id="%s">RANK: %s : %s.',$listtype, $result['score'], $status);
print '<table>';
printTableHeader($title,$content,TRUE,$fcontent);
foreach ( $result as $blname => $details ) {
if ( $blname == 'score' )
continue;
$rowspan = count ($details['values']);
$listtype = ($details['scores'][0] >0) ? 'statusListed' : 'statusWhiteListed';
printf ('<tr><td rowspan="%d">%s</td>', $rowspan, $blname);
printf ('<td id="%s">%s</td><td id="%s">%s</td>', $listtype, $details['values'][0], $listtype, $details['scores'][0]);
printf ('<td rowspan="%d">%s</td>', $rowspan, $details['score']);
printf ('<td rowspan="%d">%s</td></tr>', $rowspan, linkify($details['reason']));
for ($i=1; $i<$rowspan; $i++) {
$listtype = ($details['scores'][$i] >0) ? 'statusListed' : 'statusWhiteListed';
printf ('<tr><td id="%s">%s</td>', $listtype, $details['values'][$i]);
printf ('<td id="%s">%s</td></tr>', $listtype, $details['scores'][$i]);
}
}
print '</table>';
?>