-
Notifications
You must be signed in to change notification settings - Fork 4
/
zones.php
182 lines (167 loc) · 8.39 KB
/
zones.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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
<?php
// index.php
//
// +----------------------------------------------------------------------+
// | MultiBindAdmin http://multibindadmin.jasonantman.com |
// +----------------------------------------------------------------------+
// | Copyright (c) 2009 Jason Antman. |
// | |
// | 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, write to: |
// | |
// | Free Software Foundation, Inc. |
// | 59 Temple Place - Suite 330 |
// | Boston, MA 02111-1307, USA. |
// +----------------------------------------------------------------------+
// |Please use the above URL for bug reports and feature/support requests.|
// +----------------------------------------------------------------------+
// | Authors: Jason Antman <jason@jasonantman.com> |
// +----------------------------------------------------------------------+
// | $LastChangedRevision:: $ |
// | $HeadURL:: $ |
// +----------------------------------------------------------------------+
require_once('config/config.php');
require_once('inc/common.php');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Zones - MultiBindAdmin</title>
<link rel="stylesheet" type="text/css" href="css/common.css" />
<link rel="stylesheet" type="text/css" href="css/nav.css" />
</head>
<body>
<?php printHeader(); ?>
<div id="content">
<h2>Zones</h2>
<table class="mainTable">
<tr><th rowspan="2">ID</th><th rowspan="2">Name</th><th rowspan="2">Type</th><th rowspan="2">Views</th><th colspan="3">Inside</th><th colspan="3">Outside</th></tr>
<tr><th>Serial</th><th>RRs</th><th>Provider</th><th>Serial</th><th>RRs</th><th>Provider</th></tr>
<?php
$query = "SELECT z.zone_id,z.name,z.type,z.views,p.provider_name AS insideProvider,p2.provider_name AS outsideProvider FROM zones AS z LEFT JOIN providers AS p ON z.inside_provider_id=p.provider_id LEFT JOIN providers AS p2 ON z.outside_provider_id=p2.provider_id;";
$result = mysql_query($query);
while($row = mysql_fetch_assoc($result))
{
echo '<tr><td><a href="zone.php?id='.$row['zone_id'].'">'.$row['zone_id'].'</a></td><td>'.$row['name'].'</td><td>'.$row['type'].'</td><td>'.$row['views'].'</td>';
if($row['views'] == "both")
{
// inside
$q2 = "SELECT current_serial FROM soa_records WHERE zone_id=".$row['zone_id']." AND (view='inside' OR view='both');";
$res2 = mysql_query($q2);
$row2 = mysql_fetch_assoc($res2);
echo '<td>'.$row2['current_serial'].'</td>';
$q2 = "SELECT COUNT(*) FROM r_records WHERE zone_id=".$row['zone_id']." AND (view='inside' OR view='both');";
$res2 = mysql_query($q2);
$row2 = mysql_fetch_assoc($res2);
$count = (int)$row2['COUNT(*)'];
$q2 = "SELECT COUNT(*) FROM mx_records WHERE zone_id=".$row['zone_id']." AND (view='inside' OR view='both');";
$res2 = mysql_query($q2);
$row2 = mysql_fetch_assoc($res2);
$count += (int)$row2['COUNT(*)'];
$q2 = "SELECT COUNT(*) FROM srv_records WHERE zone_id=".$row['zone_id']." AND (view='inside' OR view='both');";
$res2 = mysql_query($q2);
$row2 = mysql_fetch_assoc($res2);
$count += (int)$row2['COUNT(*)'];
$q2 = "SELECT COUNT(*) FROM ptr_records WHERE zone_id=".$row['zone_id']." AND (view='inside' OR view='both');";
$res2 = mysql_query($q2);
$row2 = mysql_fetch_assoc($res2);
$count += (int)$row2['COUNT(*)'];
echo '<td>'.$count.'</td>';
echo '<td>'.$row['insideProvider'].'</td>';
// outside
$q2 = "SELECT current_serial FROM soa_records WHERE zone_id=".$row['zone_id']." AND (view='outside' OR view='both');";
$res2 = mysql_query($q2);
$row2 = mysql_fetch_assoc($res2);
echo '<td>'.$row2['current_serial'].'</td>';
$q2 = "SELECT COUNT(*) FROM r_records WHERE zone_id=".$row['zone_id']." AND (view='outside' OR view='both');";
$res2 = mysql_query($q2);
$row2 = mysql_fetch_assoc($res2);
$count = (int)$row2['COUNT(*)'];
$q2 = "SELECT COUNT(*) FROM mx_records WHERE zone_id=".$row['zone_id']." AND (view='outside' OR view='both');";
$res2 = mysql_query($q2);
$row2 = mysql_fetch_assoc($res2);
$count += (int)$row2['COUNT(*)'];
$q2 = "SELECT COUNT(*) FROM srv_records WHERE zone_id=".$row['zone_id']." AND (view='outside' OR view='both');";
$res2 = mysql_query($q2);
$row2 = mysql_fetch_assoc($res2);
$count += (int)$row2['COUNT(*)'];
$q2 = "SELECT COUNT(*) FROM ptr_records WHERE zone_id=".$row['zone_id']." AND (view='outside' OR view='both');";
$res2 = mysql_query($q2);
$row2 = mysql_fetch_assoc($res2);
$count += (int)$row2['COUNT(*)'];
echo '<td>'.$count.'</td>';
echo '<td>'.$row['outsideProvider'].'</td>';
}
elseif($row['views'] == "inside")
{
$q2 = "SELECT current_serial FROM soa_records WHERE zone_id=".$row['zone_id']." AND (view='inside' OR view='both');";
$res2 = mysql_query($q2);
$row2 = mysql_fetch_assoc($res2);
echo '<td>'.$row2['current_serial'].'</td>';
$q2 = "SELECT COUNT(*) FROM r_records WHERE zone_id=".$row['zone_id']." AND (view='inside' OR view='both');";
$res2 = mysql_query($q2);
$row2 = mysql_fetch_assoc($res2);
$count = (int)$row2['COUNT(*)'];
$q2 = "SELECT COUNT(*) FROM mx_records WHERE zone_id=".$row['zone_id']." AND (view='inside' OR view='both');";
$res2 = mysql_query($q2);
$row2 = mysql_fetch_assoc($res2);
$count += (int)$row2['COUNT(*)'];
$q2 = "SELECT COUNT(*) FROM srv_records WHERE zone_id=".$row['zone_id']." AND (view='inside' OR view='both');";
$res2 = mysql_query($q2);
$row2 = mysql_fetch_assoc($res2);
$count += (int)$row2['COUNT(*)'];
$q2 = "SELECT COUNT(*) FROM ptr_records WHERE zone_id=".$row['zone_id']." AND (view='inside' OR view='both');";
$res2 = mysql_query($q2);
$row2 = mysql_fetch_assoc($res2);
$count += (int)$row2['COUNT(*)'];
echo '<td>'.$count.'</td>';
echo '<td>'.$row['insideProvider'].'</td>';
echo '<td> </td><td> </td><td> </td>';
}
else
{
echo '<td> </td><td> </td><td> </td>';
$q2 = "SELECT current_serial FROM soa_records WHERE zone_id=".$row['zone_id']." AND (view='outside' OR view='both');";
$res2 = mysql_query($q2);
$row2 = mysql_fetch_assoc($res2);
echo '<td>'.$row2['current_serial'].'</td>';
$q2 = "SELECT COUNT(*) FROM r_records WHERE zone_id=".$row['zone_id']." AND (view='outside' OR view='both');";
$res2 = mysql_query($q2);
$row2 = mysql_fetch_assoc($res2);
$count = (int)$row2['COUNT(*)'];
$q2 = "SELECT COUNT(*) FROM mx_records WHERE zone_id=".$row['zone_id']." AND (view='outside' OR view='both');";
$res2 = mysql_query($q2);
$row2 = mysql_fetch_assoc($res2);
$count += (int)$row2['COUNT(*)'];
$q2 = "SELECT COUNT(*) FROM srv_records WHERE zone_id=".$row['zone_id']." AND (view='outside' OR view='both');";
$res2 = mysql_query($q2);
$row2 = mysql_fetch_assoc($res2);
$count += (int)$row2['COUNT(*)'];
$q2 = "SELECT COUNT(*) FROM ptr_records WHERE zone_id=".$row['zone_id']." AND (view='outside' OR view='both');";
$res2 = mysql_query($q2);
$row2 = mysql_fetch_assoc($res2);
$count += (int)$row2['COUNT(*)'];
echo '<td>'.$count.'</td>';
echo '<td>'.$row['outsideProvider'].'</td>';
}
echo '</tr>'."\n";
}
?>
</table>
<p class="tableBottomLink"><a href="addZone.php">+ Add Zone</a></p>
</div> <!-- close content div -->
<?php printFooter(); ?>
</body>
</html>