-
Notifications
You must be signed in to change notification settings - Fork 0
/
NSUPDATE.php
380 lines (377 loc) · 16.1 KB
/
NSUPDATE.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
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
<?php
function addTXT($NSUPDATE_CMD,$NS,$ZONE,$TSIG_PATH,$RR_NAME,$RR_TTL,$RR_TXT) {
$data = "<<EOF
server $NS
zone $ZONE
update add $RR_NAME $RR_TTL TXT $RR_TXT
send
EOF";
exec("$NSUPDATE_CMD $data", $nsaddDebugOutput, $nsaddExitCode);
return array($nsaddDebugOutput,$nsaddExitCode);
}
function addA($NSUPDATE_CMD,$NS,$ZONE,$TSIG_PATH,$RR_NAME,$RR_TTL,$RR_A) {
$data = "<<EOF
server $NS
zone $ZONE
update add $RR_NAME $RR_TTL A $RR_A
send
EOF";
exec("$NSUPDATE_CMD $data", $nsaddDebugOutput, $nsaddExitCode);
return array($nsaddDebugOutput,$nsaddExitCode);
}
function addAAAA($NSUPDATE_CMD,$NS,$ZONE,$TSIG_PATH,$RR_NAME,$RR_TTL,$RR_AAAA) {
$data = "<<EOF
server $NS
zone $ZONE
update add $RR_NAME $RR_TTL AAAA $RR_AAAA
send
EOF";
exec("$NSUPDATE_CMD $data", $nsaddDebugOutput, $nsaddExitCode);
return array($nsaddDebugOutput,$nsaddExitCode);
}
function addCNAME($NSUPDATE_CMD,$NS,$ZONE,$TSIG_PATH,$RR_NAME,$RR_TTL,$RR_CNAME) {
$data = "<<EOF
server $NS
zone $ZONE
update add $RR_NAME $RR_TTL CNAME $RR_CNAME
send
EOF";
exec("$NSUPDATE_CMD $data", $nsaddDebugOutput, $nsaddExitCode);
return array($nsaddDebugOutput,$nsaddExitCode);
}
function addMX($NSUPDATE_CMD,$NS,$ZONE,$TSIG_PATH,$RR_NAME,$RR_TTL,$RR_PRIORITY,$RR_MX) {
$data = "<<EOF
server $NS
zone $ZONE
update add $RR_NAME $RR_TTL MX $RR_PRIORITY $RR_MX
send
EOF";
exec("$NSUPDATE_CMD $data", $nsaddDebugOutput, $nsaddExitCode);
return array($nsaddDebugOutput,$nsaddExitCode);
}
function addSRV($NSUPDATE_CMD,$NS,$ZONE,$TSIG_PATH,$RR_SERVICE,$RR_PROTOCOL,$RR_NAME,$RR_TTL,$RR_PRIORITY,$RR_WEIGHT,$RR_PORT,$RR_TARGET) {
$data = "<<EOF
server $NS
zone $ZONE
update add _$RR_SERVICE._$RR_PROTOCOL.$RR_NAME $RR_TTL SRV $RR_PRIORITY $RR_WEIGHT $RR_PORT $RR_TARGET
send
EOF";
exec("$NSUPDATE_CMD $data", $nsaddDebugOutput, $nsaddExitCode);
return array($nsaddDebugOutput,$nsaddExitCode);
}
function addSSHFP($NSUPDATE_CMD,$NS,$ZONE,$TSIG_PATH,$RR_NAME,$RR_TTL,$RR_ALGORITHM,$RR_HASH,$RR_FINGERPRINT) {
$data = "<<EOF
server $NS
zone $ZONE
update add $RR_NAME $RR_TTL SSHFP $RR_ALGORITHM $RR_HASH $RR_FINGERPRINT
send
EOF";
exec("$NSUPDATE_CMD $data", $nsaddDebugOutput, $nsaddExitCode);
return array($nsaddDebugOutput,$nsaddExitCode);
}
function addTLSA($NSUPDATE_CMD,$NS,$ZONE,$TSIG_PATH,$RR_PORT,$RR_PROTOCOL,$RR_NAME,$RR_TTL,$RR_USAGE,$RR_SELECTOR,$RR_MATCHING,$RR_CERTINFO) {
$data = "<<EOF
server $NS
zone $ZONE
update add _$RR_PORT._$RR_PROTOCOL.$RR_NAME $RR_TTL TLSA $RR_USAGE $RR_SELECTOR $RR_MATCHING $RR_CERTINFO
send
EOF";
exec("$NSUPDATE_CMD $data", $nsaddDebugOutput, $nsaddExitCode);
return array($nsaddDebugOutput,$nsaddExitCode);
}
function addCAA($NSUPDATE_CMD,$NS,$ZONE,$TSIG_PATH,$RR_NAME,$RR_TTL,$RR_FLAGS,$RR_TAG,$RR_VALUE) {
$data = "<<EOF
server $NS
zone $ZONE
update add $RR_NAME $RR_TTL CAA $RR_FLAGS $RR_TAG $RR_VALUE
send
EOF";
exec("$NSUPDATE_CMD $data", $nsaddDebugOutput, $nsaddExitCode);
return array($nsaddDebugOutput,$nsaddExitCode);
}
// โหมด ADD
if ($_POST['RR_MODE'] == "ADD") {
switch ($_POST['RR_TYPE']) {
case "TXT":
$nsaddExecOutput = addTXT($NSUPDATE_CMD,$NS, $ZONE, $TSIG_PATH, $_POST['RR_NAME'], $_POST['RR_TTL'], $_POST['RR_TXT']);
break;
case "A":
$nsaddExecOutput = addA($NSUPDATE_CMD,$NS, $ZONE, $TSIG_PATH, $_POST['RR_NAME'], $_POST['RR_TTL'], $_POST['RR_A']);
break;
case "AAAA":
$nsaddExecOutput = addAAAA($NSUPDATE_CMD,$NS, $ZONE, $TSIG_PATH, $_POST['RR_NAME'], $_POST['RR_TTL'], $_POST['RR_AAAA']);
break;
case "CNAME":
$nsaddExecOutput = addCNAME($NSUPDATE_CMD,$NS, $ZONE, $TSIG_PATH, $_POST['RR_NAME'], $_POST['RR_TTL'], $_POST['RR_CNAME']);
break;
case "MX":
$nsaddExecOutput = addMX($NSUPDATE_CMD,$NS, $ZONE, $TSIG_PATH, $_POST['RR_NAME'], $_POST['RR_TTL'], $_POST['RR_PRIORITY'], $_POST['RR_MX']);
break;
case "SRV":
$nsaddExecOutput = addSRV($NSUPDATE_CMD,$NS, $ZONE, $TSIG_PATH, $_POST['RR_SERVICE'], $_POST['RR_PROTOCOL'], $_POST['RR_NAME'], $_POST['RR_TTL'], $_POST['RR_PRIORITY'], $_POST['RR_WEIGHT'], $_POST['RR_PORT'], $_POST['RR_TARGET']);
break;
case "SSHFP":
$nsaddExecOutput = addSSHFP($NSUPDATE_CMD,$NS, $ZONE, $TSIG_PATH, $_POST['RR_NAME'], $_POST['RR_TTL'], $_POST['RR_ALGORITHM'], $_POST['RR_HASH'], $_POST['RR_FINGERPRINT']);
break;
case "TLSA":
$nsaddExecOutput = addTLSA($NSUPDATE_CMD,$NS, $ZONE, $TSIG_PATH, $_POST['RR_PORT'], $_POST['RR_PROTOCOL'], $_POST['RR_NAME'], $_POST['RR_TTL'], $_POST['RR_USAGE'], $_POST['RR_SELECTOR'], $_POST['RR_MATCHING'], $_POST['RR_CERTINFO']);
break;
case "CAA":
$nsaddExecOutput = addCAA($NSUPDATE_CMD,$NS, $ZONE, $TSIG_PATH, $_POST['RR_NAME'], $_POST['RR_TTL'], $_POST['RR_FLAGS'], $_POST['RR_TAG'], $_POST['RR_VALUE']);
break;
}
}
function deleteTXT($NSUPDATE_CMD,$NS,$ZONE,$TSIG_PATH,$RR_NAME,$RR_TTL,$RR_TXT) {
$data = "<<EOF
server $NS
zone $ZONE
update delete $RR_NAME $RR_TTL TXT $RR_TXT
send
EOF";
exec("$NSUPDATE_CMD $data", $nsaddDebugOutput, $nsaddExitCode);
return array($nsaddDebugOutput,$nsaddExitCode);
}
function deleteA($NSUPDATE_CMD,$NS,$ZONE,$TSIG_PATH,$RR_NAME,$RR_TTL,$RR_A) {
$data = "<<EOF
server $NS
zone $ZONE
update delete $RR_NAME $RR_TTL A $RR_A
send
EOF";
exec("$NSUPDATE_CMD $data", $nsaddDebugOutput, $nsaddExitCode);
return array($nsaddDebugOutput,$nsaddExitCode);
}
function deleteAAAA($NSUPDATE_CMD,$NS,$ZONE,$TSIG_PATH,$RR_NAME,$RR_TTL,$RR_AAAA) {
$data = "<<EOF
server $NS
zone $ZONE
update delete $RR_NAME $RR_TTL AAAA $RR_AAAA
send
EOF";
exec("$NSUPDATE_CMD $data", $nsaddDebugOutput, $nsaddExitCode);
return array($nsaddDebugOutput,$nsaddExitCode);
}
function deleteCNAME($NSUPDATE_CMD,$NS,$ZONE,$TSIG_PATH,$RR_NAME,$RR_TTL,$RR_CNAME) {
$data = "<<EOF
server $NS
zone $ZONE
update delete $RR_NAME $RR_TTL CNAME $RR_CNAME
send
EOF";
exec("$NSUPDATE_CMD $data", $nsaddDebugOutput, $nsaddExitCode);
return array($nsaddDebugOutput,$nsaddExitCode);
}
function deleteMX($NSUPDATE_CMD,$NS,$ZONE,$TSIG_PATH,$RR_NAME,$RR_TTL,$RR_PRIORITY,$RR_MX) {
$data = "<<EOF
server $NS
zone $ZONE
update delete $RR_NAME $RR_TTL MX $RR_PRIORITY $RR_MX
send
EOF";
exec("$NSUPDATE_CMD $data", $nsaddDebugOutput, $nsaddExitCode);
return array($nsaddDebugOutput,$nsaddExitCode);
}
function deleteSRV($NSUPDATE_CMD,$NS,$ZONE,$TSIG_PATH,$RR_SERVICE,$RR_PROTOCOL,$RR_NAME,$RR_TTL,$RR_PRIORITY,$RR_WEIGHT,$RR_PORT,$RR_TARGET) {
$data = "<<EOF
server $NS
zone $ZONE
update delete _$RR_SERVICE._$RR_PROTOCOL.$RR_NAME $RR_TTL SRV $RR_PRIORITY $RR_WEIGHT $RR_PORT $RR_TARGET
send
EOF";
exec("$NSUPDATE_CMD $data", $nsaddDebugOutput, $nsaddExitCode);
return array($nsaddDebugOutput,$nsaddExitCode);
}
function deleteSSHFP($NSUPDATE_CMD,$NS,$ZONE,$TSIG_PATH,$RR_NAME,$RR_TTL,$RR_ALGORITHM,$RR_HASH,$RR_FINGERPRINT) {
$data = "<<EOF
server $NS
zone $ZONE
update delete $RR_NAME $RR_TTL SSHFP $RR_ALGORITHM $RR_HASH $RR_FINGERPRINT
send
EOF";
exec("$NSUPDATE_CMD $data", $nsaddDebugOutput, $nsaddExitCode);
return array($nsaddDebugOutput,$nsaddExitCode);
}
function deleteTLSA($NSUPDATE_CMD,$NS,$ZONE,$TSIG_PATH,$RR_PORT,$RR_PROTOCOL,$RR_NAME,$RR_TTL,$RR_USAGE,$RR_SELECTOR,$RR_MATCHING,$RR_CERTINFO) {
$data = "<<EOF
server $NS
zone $ZONE
update delete _$RR_PORT._$RR_PROTOCOL.$RR_NAME $RR_TTL TLSA $RR_USAGE $RR_SELECTOR $RR_MATCHING $RR_CERTINFO
send
EOF";
exec("$NSUPDATE_CMD $data", $nsaddDebugOutput, $nsaddExitCode);
return array($nsaddDebugOutput,$nsaddExitCode);
}
function deleteCAA($NSUPDATE_CMD,$NS,$ZONE,$TSIG_PATH,$RR_NAME,$RR_TTL,$RR_FLAGS,$RR_TAG,$RR_VALUE) {
$data = "<<EOF
server $NS
zone $ZONE
update delete $RR_NAME $RR_TTL CAA $RR_FLAGS $RR_TAG $RR_VALUE
send
EOF";
exec("$NSUPDATE_CMD $data", $nsaddDebugOutput, $nsaddExitCode);
return array($nsaddDebugOutput,$nsaddExitCode);
}
// โหมด DELETE
if ($_POST['RR_MODE'] == "DELETE") {
switch ($_POST['RR_TYPE']) {
case "TXT":
$nsaddExecOutput = deleteTXT($NSUPDATE_CMD,$NS, $ZONE, $TSIG_PATH, $_POST['RR_NAME'], $_POST['RR_TTL'], $_POST['RR_TXT']);
break;
case "A":
$nsaddExecOutput = deleteA($NSUPDATE_CMD,$NS, $ZONE, $TSIG_PATH, $_POST['RR_NAME'], $_POST['RR_TTL'], $_POST['RR_A']);
break;
case "AAAA":
$nsaddExecOutput = deleteAAAA($NSUPDATE_CMD,$NS, $ZONE, $TSIG_PATH, $_POST['RR_NAME'], $_POST['RR_TTL'], $_POST['RR_AAAA']);
break;
case "CNAME":
$nsaddExecOutput = deleteCNAME($NSUPDATE_CMD,$NS, $ZONE, $TSIG_PATH, $_POST['RR_NAME'], $_POST['RR_TTL'], $_POST['RR_CNAME']);
break;
case "MX":
$nsaddExecOutput = deleteMX($NSUPDATE_CMD,$NS, $ZONE, $TSIG_PATH, $_POST['RR_NAME'], $_POST['RR_TTL'], $_POST['RR_PRIORITY'], $_POST['RR_MX']);
break;
case "SRV":
$nsaddExecOutput = deleteSRV($NSUPDATE_CMD,$NS, $ZONE, $TSIG_PATH, $_POST['RR_SERVICE'], $_POST['RR_PROTOCOL'], $_POST['RR_NAME'], $_POST['RR_TTL'], $_POST['RR_PRIORITY'], $_POST['RR_WEIGHT'], $_POST['RR_PORT'], $_POST['RR_TARGET']);
break;
case "SSHFP":
$nsaddExecOutput = deleteSSHFP($NSUPDATE_CMD,$NS, $ZONE, $TSIG_PATH, $_POST['RR_NAME'], $_POST['RR_TTL'], $_POST['RR_ALGORITHM'], $_POST['RR_HASH'], $_POST['RR_FINGERPRINT']);
break;
case "TLSA":
$nsaddExecOutput = deleteTLSA($NSUPDATE_CMD,$NS, $ZONE, $TSIG_PATH, $_POST['RR_PORT'], $_POST['RR_PROTOCOL'], $_POST['RR_NAME'], $_POST['RR_TTL'], $_POST['RR_USAGE'], $_POST['RR_SELECTOR'], $_POST['RR_MATCHING'], $_POST['RR_CERTINFO']);
break;
case "CAA":
$nsaddExecOutput = deleteCAA($NSUPDATE_CMD,$NS, $ZONE, $TSIG_PATH, $_POST['RR_NAME'], $_POST['RR_TTL'], $_POST['RR_FLAGS'], $_POST['RR_TAG'], $_POST['RR_VALUE']);
break;
}
}
function updateTXT($NSUPDATE_CMD,$NS,$ZONE,$TSIG_PATH,$RR_NAME,$RR_TTL,$RR_TXT,$RR_NAME_OLD,$RR_TTL_OLD,$RR_TXT_OLD) {
$data = "<<EOF
server $NS
zone $ZONE
update delete $RR_NAME_OLD $RR_TTL_OLD TXT $RR_TXT_OLD
update add $RR_NAME $RR_TTL TXT $RR_TXT
send
EOF";
exec("$NSUPDATE_CMD $data", $nsaddDebugOutput, $nsaddExitCode);
return array($nsaddDebugOutput,$nsaddExitCode);
}
function updateA($NSUPDATE_CMD,$NS,$ZONE,$TSIG_PATH,$RR_NAME,$RR_TTL,$RR_A,$RR_NAME_OLD,$RR_TTL_OLD,$RR_A_OLD) {
$data = "<<EOF
server $NS
zone $ZONE
update delete $RR_NAME_OLD $RR_TTL_OLD A $RR_A_OLD
update add $RR_NAME $RR_TTL A $RR_A
send
EOF";
exec("$NSUPDATE_CMD $data", $nsaddDebugOutput, $nsaddExitCode);
return array($nsaddDebugOutput,$nsaddExitCode);
}
function updateAAAA($NSUPDATE_CMD,$NS,$ZONE,$TSIG_PATH,$RR_NAME,$RR_TTL,$RR_AAAA,$RR_NAME_OLD,$RR_TTL_OLD,$RR_AAAA_OLD) {
$data = "<<EOF
server $NS
zone $ZONE
update delete $RR_NAME_OLD $RR_TTL_OLD AAAA $RR_AAAA_OLD
update add $RR_NAME $RR_TTL AAAA $RR_AAAA
send
EOF";
exec("$NSUPDATE_CMD $data", $nsaddDebugOutput, $nsaddExitCode);
return array($nsaddDebugOutput,$nsaddExitCode);
}
function updateCNAME($NSUPDATE_CMD,$NS,$ZONE,$TSIG_PATH,$RR_NAME,$RR_TTL,$RR_CNAME,$RR_NAME_OLD,$RR_TTL_OLD,$RR_CNAME_OLD) {
$data = "<<EOF
server $NS
zone $ZONE
update delete $RR_NAME_OLD $RR_TTL_OLD CNAME $RR_CNAME_OLD
update add $RR_NAME $RR_TTL CNAME $RR_CNAME
send
EOF";
exec("$NSUPDATE_CMD $data", $nsaddDebugOutput, $nsaddExitCode);
return array($nsaddDebugOutput,$nsaddExitCode);
}
function updateMX($NSUPDATE_CMD,$NS,$ZONE,$TSIG_PATH,$RR_NAME,$RR_TTL,$RR_PRIORITY,$RR_MX,$RR_NAME_OLD,$RR_TTL_OLD,$RR_PRIORITY_OLD,$RR_MX_OLD) {
$data = "<<EOF
server $NS
zone $ZONE
update delete $RR_NAME_OLD $RR_TTL_OLD MX $RR_PRIORITY_OLD $RR_MX_OLD
update add $RR_NAME $RR_TTL MX $RR_PRIORITY $RR_MX
send
EOF";
exec("$NSUPDATE_CMD $data", $nsaddDebugOutput, $nsaddExitCode);
return array($nsaddDebugOutput,$nsaddExitCode);
}
function updateSRV($NSUPDATE_CMD,$NS,$ZONE,$TSIG_PATH,$RR_SERVICE,$RR_PROTOCOL,$RR_NAME,$RR_TTL,$RR_PRIORITY,$RR_WEIGHT,$RR_PORT,$RR_TARGET,$RR_SERVICE_OLD,$RR_PROTOCOL_OLD,$RR_NAME_OLD,$RR_TTL_OLD,$RR_PRIORITY_OLD,$RR_WEIGHT_OLD,$RR_PORT_OLD,$RR_TARGET_OLD) {
$data = "<<EOF
server $NS
zone $ZONE
update delete _$RR_SERVICE_OLD._$RR_PROTOCOL_OLD.$RR_NAME_OLD $RR_TTL_OLD SRV $RR_PRIORITY_OLD $RR_WEIGHT_OLD $RR_PORT_OLD $RR_TARGET_OLD
update add _$RR_SERVICE._$RR_PROTOCOL.$RR_NAME $RR_TTL SRV $RR_PRIORITY $RR_WEIGHT $RR_PORT $RR_TARGET
send
EOF";
exec("$NSUPDATE_CMD $data", $nsaddDebugOutput, $nsaddExitCode);
return array($nsaddDebugOutput,$nsaddExitCode);
}
function updateSSHFP($NSUPDATE_CMD,$NS,$ZONE,$TSIG_PATH,$RR_NAME,$RR_TTL,$RR_ALGORITHM,$RR_HASH,$RR_FINGERPRINT,$RR_NAME_OLD,$RR_TTL_OLD,$RR_ALGORITHM_OLD,$RR_HASH_OLD,$RR_FINGERPRINT_OLD) {
$data = "<<EOF
server $NS
zone $ZONE
update delete $RR_NAME_OLD $RR_TTL_OLD SSHFP $RR_ALGORITHM_OLD $RR_HASH_OLD $RR_FINGERPRINT_OLD
update add $RR_NAME $RR_TTL SSHFP $RR_ALGORITHM $RR_HASH $RR_FINGERPRINT
send
EOF";
exec("$NSUPDATE_CMD $data", $nsaddDebugOutput, $nsaddExitCode);
return array($nsaddDebugOutput,$nsaddExitCode);
}
function updateTLSA($NSUPDATE_CMD,$NS,$ZONE,$TSIG_PATH,$RR_PORT,$RR_PROTOCOL,$RR_NAME,$RR_TTL,$RR_USAGE,$RR_SELECTOR,$RR_MATCHING,$RR_CERTINFO,$RR_PORT_OLD,$RR_PROTOCOL_OLD,$RR_NAME_OLD,$RR_TTL_OLD,$RR_USAGE_OLD,$RR_SELECTOR_OLD,$RR_MATCHING_OLD,$RR_CERTINFO_OLD) {
$data = "<<EOF
server $NS
zone $ZONE
update delete _$RR_PORT_OLD._$RR_PROTOCOL_OLD.$RR_NAME_OLD $RR_TTL_OLD TLSA $RR_USAGE_OLD $RR_SELECTOR_OLD $RR_MATCHING_OLD $RR_CERTINFO_OLD
update add _$RR_PORT._$RR_PROTOCOL.$RR_NAME $RR_TTL TLSA $RR_USAGE $RR_SELECTOR $RR_MATCHING $RR_CERTINFO
send
EOF";
exec("$NSUPDATE_CMD $data", $nsaddDebugOutput, $nsaddExitCode);
return array($nsaddDebugOutput,$nsaddExitCode);
}
function updateCAA($NSUPDATE_CMD,$NS,$ZONE,$TSIG_PATH,$RR_NAME,$RR_TTL,$RR_FLAGS,$RR_TAG,$RR_VALUE,$RR_NAME_OLD,$RR_TTL_OLD,$RR_FLAGS_OLD,$RR_TAG_OLD,$RR_VALUE_OLD) {
$data = "<<EOF
server $NS
zone $ZONE
update delete $RR_NAME_OLD $RR_TTL_OLD CAA $RR_FLAGS_OLD $RR_TAG_OLD $RR_VALUE_OLD
update add $RR_NAME $RR_TTL CAA $RR_FLAGS $RR_TAG $RR_VALUE
send
EOF";
exec("$NSUPDATE_CMD $data", $nsaddDebugOutput, $nsaddExitCode);
return array($nsaddDebugOutput,$nsaddExitCode);
}
// โหมด UPDATE
if ($_POST['RR_MODE'] == "UPDATE") {
switch ($_POST['RR_TYPE']) {
case "TXT":
$nsaddExecOutput = updateTXT($NSUPDATE_CMD,$NS, $ZONE, $TSIG_PATH, $_POST['RR_NAME'], $_POST['RR_TTL'], $_POST['RR_TXT'], $_POST['RR_NAME_OLD'], $_POST['RR_TTL_OLD'], $_POST['RR_TXT_OLD']);
break;
case "A":
$nsaddExecOutput = updateA($NSUPDATE_CMD,$NS, $ZONE, $TSIG_PATH, $_POST['RR_NAME'], $_POST['RR_TTL'], $_POST['RR_A'], $_POST['RR_NAME_OLD'], $_POST['RR_TTL_OLD'], $_POST['RR_A_OLD']);
break;
case "AAAA":
$nsaddExecOutput = updateAAAA($NSUPDATE_CMD,$NS, $ZONE, $TSIG_PATH, $_POST['RR_NAME'], $_POST['RR_TTL'], $_POST['RR_AAAA'], $_POST['RR_NAME_OLD'], $_POST['RR_TTL_OLD'], $_POST['RR_AAAA_OLD']);
break;
case "CNAME":
$nsaddExecOutput = updateCNAME($NSUPDATE_CMD,$NS, $ZONE, $TSIG_PATH, $_POST['RR_NAME'], $_POST['RR_TTL'], $_POST['RR_CNAME'], $_POST['RR_NAME_OLD'], $_POST['RR_TTL_OLD'], $_POST['RR_CNAME_OLD']);
break;
case "MX":
$nsaddExecOutput = updateMX($NSUPDATE_CMD,$NS, $ZONE, $TSIG_PATH, $_POST['RR_NAME'], $_POST['RR_TTL'], $_POST['RR_PRIORITY'], $_POST['RR_MX'], $_POST['RR_NAME_OLD'], $_POST['RR_TTL_OLD'], $_POST['RR_PRIORITY_OLD'], $_POST['RR_MX_OLD']);
break;
case "SRV":
$nsaddExecOutput = updateSRV($NSUPDATE_CMD,$NS, $ZONE, $TSIG_PATH, $_POST['RR_SERVICE'], $_POST['RR_PROTOCOL'], $_POST['RR_NAME'], $_POST['RR_TTL'], $_POST['RR_PRIORITY'], $_POST['RR_WEIGHT'], $_POST['RR_PORT'], $_POST['RR_TARGET'], $_POST['RR_SERVICE_OLD'], $_POST['RR_PROTOCOL_OLD'], $_POST['RR_NAME_OLD'], $_POST['RR_TTL_OLD'], $_POST['RR_PRIORITY_OLD'], $_POST['RR_WEIGHT_OLD'], $_POST['RR_PORT_OLD'], $_POST['RR_TARGET_OLD']);
break;
case "SSHFP":
$nsaddExecOutput = updateSSHFP($NSUPDATE_CMD,$NS, $ZONE, $TSIG_PATH, $_POST['RR_NAME'], $_POST['RR_TTL'], $_POST['RR_ALGORITHM'], $_POST['RR_HASH'], $_POST['RR_FINGERPRINT'], $_POST['RR_NAME_OLD'], $_POST['RR_TTL_OLD'], $_POST['RR_ALGORITHM_OLD'], $_POST['RR_HASH_OLD'], $_POST['RR_FINGERPRINT_OLD']);
break;
case "TLSA":
$nsaddExecOutput = updateTLSA($NSUPDATE_CMD,$NS, $ZONE, $TSIG_PATH, $_POST['RR_PORT'], $_POST['RR_PROTOCOL'], $_POST['RR_NAME'], $_POST['RR_TTL'], $_POST['RR_USAGE'], $_POST['RR_SELECTOR'], $_POST['RR_MATCHING'], $_POST['RR_CERTINFO'], $_POST['RR_PORT_OLD'], $_POST['RR_PROTOCOL_OLD'], $_POST['RR_NAME_OLD'], $_POST['RR_TTL_OLD'], $_POST['RR_USAGE_OLD'], $_POST['RR_SELECTOR_OLD'], $_POST['RR_MATCHING_OLD'], $_POST['RR_CERTINFO_OLD']);
break;
case "CAA":
$nsaddExecOutput = updateCAA($NSUPDATE_CMD,$NS, $ZONE, $TSIG_PATH, $_POST['RR_NAME'], $_POST['RR_TTL'], $_POST['RR_FLAGS'], $_POST['RR_TAG'], $_POST['RR_VALUE'], $_POST['RR_NAME_OLD'], $_POST['RR_TTL_OLD'], $_POST['RR_FLAGS_OLD'], $_POST['RR_TAG_OLD'], $_POST['RR_VALUE_OLD']);
break;
}
}
?>