forked from frootmig/esgobweb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
soa.php
162 lines (152 loc) · 4.13 KB
/
soa.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
<link href="bootstrap-3.3.5-dist/css/bootstrap.min.css" rel="stylesheet">
<?php
/*
Copyright (C) 2015 Volker Janzen
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>
*/
//require_once('config.inc.php');
require_once('proxy.inc.php');
include('header.inc.php');
$domain = '';
if (isset($_GET['domain'])) {
$domain = $_GET['domain'];
}
if ($domain != '') {
$data = simple_get('domains.tools.soacheck', $domain);
}
if ($domain == '') {
echo('<div class="alert alert-danger" role="alert">No domain name set</div>');
} else if (!is_object($data)) {
echo('<div class="alert alert-danger" role="alert">Webservice call did not return response</div>');
} else {
echo('<h1>');
echo(htmlentities($data->domain));
echo('</h1>');
echo('<div class="well">Information was ');
if ($data->cached) {
echo('cached');
echo(' for ');
echo(htmlentities($data->cachefor));
echo(' seconds on ');
echo(htmlentities(date(DATE_RFC822, $data->timestamp)));
} else {
echo('not cached');
}
echo('</div>');
echo('<h2>Analysis</h2>');
if (is_object($data->analysis) && $data->analysis->mastersok && $data->analysis->consistent && $data->analysis->nodesok) {
echo('<div class="alert alert-success" role="alert">');
} else {
echo('<div class="alert alert-danger" role="alert">');
}
echo(' ');
if (is_object($data->analysis)) {
if ($data->analysis->mastersok) {
echo('Master OK.');
} else {
echo('<strong>Master error.</strong>');
}
echo(' ');
if ($data->analysis->nodesok) {
echo('Nodes OK.');
} else {
echo('<strong>Nodes error.</strong>');
}
echo(' ');
if ($data->analysis->consistent) {
echo('Data is consistent.');
} else {
echo('<strong>Data is not consistent.</strong>');
}
} else {
echo('<strong>Analysis data format error.</strong>');
}
echo(' ');
echo('</div>');
echo('<h2>Masters</h2>');
echo('<table class="table table-striped">');
echo('<thead>');
echo('<tr>');
echo('<th>IP</th>');
echo('<th>SOA</th>');
echo('<th>Response</th>');
echo('</tr>');
echo('</thead>');
foreach ($data->responses->masters as $m) {
echo('<tr>');
echo('<td>');
echo htmlentities($m->ip);
echo('</td>');
echo('<td>');
echo htmlentities($m->soa);
echo('</td>');
echo('<td>');
echo htmlentities($m->response);
echo('</td>');
echo('</tr>');
}
echo('</table>');
echo('<h2>AXFR nodes</h2>');
echo('<table class="table table-striped">');
echo('<thead>');
echo('<tr>');
echo('<th>SOA</th>');
echo('<th>Response</th>');
echo('</tr>');
echo('</thead>');
foreach ($data->responses->axfrnodes as $m) {
echo('<tr>');
echo('<td>');
echo htmlentities($m->soa);
echo('</td>');
echo('<td>');
echo htmlentities($m->response);
echo('</td>');
echo('</tr>');
}
echo('</table>');
echo('<h2>Anycast node status</h2>');
echo('<table class="table table-striped">');
echo('<thead>');
echo('<tr>');
echo('<th>Country</th>');
echo('<th>Location</th>');
echo('<th>SOA</th>');
echo('<th>Response</th>');
echo('</tr>');
echo('</thead>');
foreach ($data->responses->anycastnodes as $a) {
echo('<tr>');
echo('<td>');
$country = strtoupper($a->country);
$flag_file = FLAG_FOLDER.$a->country.'.png';
if (FLAG_FOLDER != '' && file_exists($flag_file)) {
echo('<img src="'.$flag_file.'" alt="'.htmlentities($country).'" />');
} else {
echo htmlentities($country);
}
echo('</td>');
echo('<td>');
echo htmlentities($a->location);
echo('</td>');
echo('<td>');
echo htmlentities($a->soa);
echo('</td>');
echo('<td>');
echo htmlentities($a->response);
echo('</td>');
echo('</tr>');
}
echo('</table>');
}
//include('footer.inc.php');
?>