-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathdns.php
673 lines (608 loc) · 29.3 KB
/
dns.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
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
<?php
/*
* dns.php
*
* Copyright (C) 2013-2024 by Erland Hedman <[email protected]>
*
* 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
* 2 of the License, or (at your option) any later version.
*/
include 'cgi-bin/common.php';
$rowIndx=1;
//if (count($_POST)) {echo "<pre>"; print_r($_POST); echo "</pre>";exit;}
if (count($_GET) && $_GET["refresh"] == 1) {
@system("alleases ".g_domain().">/tmp/dmlist");
}
if (count($_POST) && $_POST["POST_ACTION"] == "OK") {
if (! function_exists('pcntl_fork')) die('PCNTL functions not available on this PHP installation');
$pid = pcntl_fork();
if ($pid == -1) {
echo("<pre>pcntl_fork: failed - check the extension for pcntl.so\n");
print_r(error_get_last());
echo "</pre>\n"; exit;
} else if (!$pid) {
if ($_POST["f_dns_enable"] == 1) {
if (dnsIsConfigured($_POST["f_local_domain"], $_POST["f_serving_zone"]) == false) {
do_dbhome(implode(" ", $_POST));
do_dbrev(implode(" ", $_POST));
} else {
do_updatedns($_POST["f_forwarder_1"],$_POST["f_forwarder_2"],
$_POST["f_redir_spf"],$_POST["f_spf_here"],$_POST["f_local_domain"],
$_POST["f_bl_enable"],$_POST["f_serving_zone"],g_lan(),g_lan1());
if (g_srvstat("dhcpd") == false) {
if (g_srvstat("named") == false)
@system("/usr/bin/systemctl restart bind9");
do_dbrecords(implode(" ", $_POST));
sleep(5);
}
@system("alleases ".g_domain().">/tmp/dmlist");
}
@system("/usr/bin/systemctl enable bind9");
@system("/usr/bin/systemctl restart bind9");
do_updatedhcp($_POST["ip_local_host_1"]);
} else {
do_updatedhcp($_POST["f_forwarder_1"], $_POST["f_forwarder_2"]);
@system("/usr/bin/systemctl stop bind9");
@system("/usr/sbin/update-rc.d bind9 disable");
}
} else {
if ($_POST["f_dns_enable"] == 1) {
$tm=20;
} else $tm=6;
header('Location: http://'. $_SERVER["SERVER_ADDR"]. '/wait.php?seconds='.$tm.'&loc='.$_SERVER['SCRIPT_NAME']);
exit;
}
}
function tt($msg=0)
{
switch ($msg) {
case '1':
echo "127.0.0.1 to kill the URL locally on your PC or a\nlocal host to post-process the offending url";
break;
case '2':
echo "The virtual IP-Address to the left must\nbe statically free i.e, outside any DHCP ranges";
break;
default:
break;
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="/css/bridge.css">
<title><?php p_title(); ?></title>
<script>
<?php setTimeout(); ?>
<?php include 'inc/general.js.php' ?>
function checkPage()
{
var f=getObj("form");
var n=1;
restartTimeout();
if (f.dns_enable.checked == true) {
while (ip=getObj("ip_local_host_"+n++)) {
try {
if (isFieldBlank(ip.value) == true) {
ip.select();
alert("Blank IP-address");
return false;
}
if (isIPValid(ip) == false) {
alert("Invalid IP-address "+ip.value);
ip.select();
return false;
}
}
catch(err) { break; }
}
if (f.do_spamft.checked == true) {
if (isFieldBlank(f.redir_spf.value) == true) {
f.redir_spf.select();
alert("Blank IP-address");
return false;
}
if (isIPValid(f.redir_spf) == false) {
alert("Invalid IP-address "+f.redir_spf.value);
f.redir_spf.select();
return false;
}
}
if (isFieldBlank(f.serving_zone.value) == true) {
f.serving_zone.select();
alert("Blank IP-address");
return false;
}
check_blu();
check_ggj();
f.f_redir_spf.value = f.redir_spf.value;
f.f_forwarder_1.value = f.forwarder_1.value;
f.f_forwarder_2.value = f.forwarder_2.value;
f.f_serving_zone.value = f.serving_zone.value;
}
if (isFieldBlank(f.forwarder_1.value) == true) {
getObj("show_dns_items").style.display = "block";
f.forwarder_1.select();
alert("Blank IP-address");
return false;
}
if (isIPValid(f.forwarder_1) == false) {
getObj("show_dns_items").style.display = "block";
alert("Invalid IP-address "+f.forwarder_1.value);
f.forwarder_1.select();
return false;
}
if (isFieldBlank(f.forwarder_2.value) == true) {
getObj("show_dns_items").style.display = "block";
f.forwarder_2.select();
alert("Blank IP-address");
return false;
}
if (isIPValid(f.forwarder_2) == false) {
getObj("show_dns_items").style.display = "block";
alert("Invalid IP-address "+f.forwarder_2.value);
f.forwarder_2.select();
return false;
}
f.f_forwarder_1.value = f.forwarder_1.value;
f.f_forwarder_2.value = f.forwarder_2.value;
f.POST_ACTION.value = "OK";
f.submit();
return true;
}
/* page init functoin */
function initPage()
{
// init here ...
var f=getObj("form");
if (<?php if(g_srvstat("named")) echo "true"; else echo "false"; ?>) {
getObj("show_dns_items").style.display = "block";
getObj("show_local_items").style.display = "block";
getObj("show_spam_items").style.display = "block";
getObj("show_add_host").style.display = "block";
f.f_dns_enable.value = 1;
} else {
getObj("show_dns_items").style.display = "none";
getObj("show_local_items").style.display = "none";
getObj("show_spam_items").style.display = "none";
getObj("show_add_host").style.display = "none";
f.f_dns_enable.value = 0;
}
if (<?php if(g_spamfmode() == true) echo "1"; else echo "0"; ?>) {
getObj("show_spam_features").style.display = "block";
getObj("show_bl_help").style.display = "block";
f.do_spamft.checked = true;
} else {
getObj("show_spam_features").style.display = "none";
getObj("show_bl_help").style.display = "none";
}
if (<?php echo g_spfhere()? '1':'0'; ?>) {
getObj("show_bl_options").style.display = "block";
} else {
getObj("show_bl_options").style.display = "none";
}
f.do_ggj.checked = true; // tbd
return true;
}
function onchange_dns()
{
var f=getObj("form");
<?php if (g_srvstat("named")) { ?>
if (f.dns_enable.checked == false) {
getObj("show_dns_items").style.display = "none";
getObj("show_local_items").style.display = "none";
getObj("show_spam_items").style.display = "none";
getObj("show_add_host").style.display = "none";
f.f_dns_enable.value = 0;
} else {
getObj("show_dns_items").style.display = "block";
getObj("show_local_items").style.display = "block";
getObj("show_spam_items").style.display = "block";
getObj("show_add_host").style.display = "block";
f.f_dns_enable.value = 1;
}
<?php } else {?>
f.f_dns_enable.value = (f.dns_enable.checked? "1":"0");
<?php }?>
return true;
}
function check_spamft()
{
var f=getObj("form");
if (f.do_spamft.checked == false) {
getObj("show_spam_features").style.display = "none";
getObj("show_bl_help").style.display = "none";
f.f_bl_enable.value = 0;
} else {
getObj("show_spam_features").style.display = "block";
getObj("show_bl_help").style.display = "block";
f.f_bl_enable.value = 1;
}
}
function check_blu()
{
/* works no more :-(
var f=getObj("form");
if (f.do_blu.checked == false)
f.f_bl_updates.value = 0;
else
f.f_bl_updates.value = 1;
*/
}
function check_ggj()
{
/* works no more :-(
var f=getObj("form");
if (f.do_ggj.checked == false)
f.f_gg_jumps.value = 0;
else
f.f_gg_jumps.value = 1;
*/
}
function check_spfhere()
{
var f=getObj("form");
var ck=getObj("spf_here");
if (ck.checked == true) {
f.f_spf_here.value = 1;
getObj("show_bl_options").style.display = "block";
} else {
f.f_spf_here.value = 0;
getObj("show_bl_options").style.display = "none";
}
}
function check_copy()
{
var f=getObj("form");
f.res_ip.value="<?php echo $_SERVER['REMOTE_ADDR']; ?>";
f.res_name.value="<?php system("if [ \"`pidof named`\" ]; then nslookup ".$_SERVER['REMOTE_ADDR']." localhost | grep name | awk '{gsub(\".".g_domain().".\",\"\");printf \"%s\", $4}'; fi"); ?>";
if (f.res_name.value == "")
f.res_name.value="<?php system('nbtscan -q '.$_SERVER['REMOTE_ADDR']." | awk '{print tolower(".'$2'.")}' | tr -d '\n'") ?>";
f.res_indx.value=0;
restartTimeout();
return true;
}
function ed_row(n)
{
var f=getObj("form");
f.res_ip.value=getObj("ip_local_host_"+n).value;
f.res_name.value=getObj("nm_local_host_"+n).value;
getObj("st_local_host_"+n).value = 1;
getObj("im_local_host_"+n).src = "/img/delete.jpg";
f.res_indx.value=n;
restartTimeout();
return true;
}
function rm_row(n)
{
var f=getObj("form");
getObj("st_local_host_"+n).value = 2;
getObj("im_local_host_"+n).src = "/img/deleted.jpg";
f.res_indx.value=0;
f.res_ip.value = f.res_name.value ="";
restartTimeout();
return true;
}
function check_res()
{
var f=getObj("form");
var n=0;
var rowIndx = getObj("restable").getElementsByTagName("tbody")[0].getElementsByTagName("tr").length;
if (rowIndx >= <?php echo C_MAX ?>) {
alert("Attempt to exceed the limit for a class C netwok (<?php echo C_MAX ?>)");
return false;
}
if (isFieldBlank(f.res_ip.value) == true) {
f.res_ip.select();
alert("Blank new IP-address");
return false;
}
if (isIPValid(f.res_ip) == false) {
alert("Invalid new IP-address "+f.res_ip.value);
f.res_ip.select();
return false;
}
if (isFieldBlank(f.res_name.value) == true) {
f.res_name.select();
alert("Blank new Host Name");
return false;
}
n = f.res_indx.value;
for( var i=2; i < rowIndx; i++ ) {
if (i==n) continue;
if (f.res_ip.value == getObj("ip_local_host_"+i).value) {
alert("Reserved IP address ("+f.res_ip.value+") is already used."); return false;
}
if (f.res_name.value == getObj("nm_local_host_"+i).value) {
alert("Name ("+f.res_name.value+") is already used."); return false;
}
if (isSubnetSame("<?php p_srvzone() ?>", f.res_ip.value, "<?php p_mask(g_lan()) ?>")) {
alert("The IP address ("+f.res_ip.value+") is not in this DNS Server's served Local Zone."); return false;
}
}
if (n > 0) {
getObj("ip_local_host_"+n).value = f.res_ip.value;
getObj("nm_local_host_"+n).value = f.res_name.value;
f.res_ip.value = f.res_name.value ="";
f.res_indx.value=0;
return true;
}
var table = getObj("restable");
var row = table.insertRow(rowIndx);
var stn = row.insertCell(0);
var ip = row.insertCell(1);
var dl = row.insertCell(2);
var ed = row.insertCell(3);
var st_str="\n<input name='st_local_host_"+rowIndx+"' id='st_local_host_"+rowIndx+"' value='1' type='hidden'>";
var nm_str="<input readonly='readonly' name='nm_local_host_"+rowIndx+"' id='nm_local_host_"+rowIndx+"' size='16' maxlength='15' value='"+f.res_name.value+"' type='text'>";
stn.innerHTML = st_str + nm_str;
ip.innerHTML = "<input readonly='readonly' name='ip_local_host_"+rowIndx+"' id='ip_local_host_"+rowIndx+"' size='16' maxlength='15' value='"+f.res_ip.value+"' type='text'>";
dl.innerHTML='<img alt="del" id="im_local_host_'+rowIndx+'" onclick="rm_row('+rowIndx+')" src="/img/delete.jpg" style="border:0">'+"\n";
ed.innerHTML='<img alt="edit" onclick="ed_row('+rowIndx+')" src="/img/edit.jpg" style="border:0">';
restartTimeout();
f.res_indx.value=0;
f.res_ip.value = f.res_name.value ="";
}
</script>
</head>
<body onload="initPage();"><script>onbody();</script>
<form name="form" id="form" method="post" action="<?php echo $_SERVER['SCRIPT_NAME']; ?>" onsubmit="return checkPage();">
<input name="POST_ACTION" value="" type="hidden">
<input name="f_dns_enable" id="f_dns_enable" value="0" type="hidden">
<input name="f_bl_enable" id="f_bl_enable" value="<?php echo g_spamfmode()? '1':'0'; ?>" type="hidden">
<input name="f_bl_updates" id="f_bl_updates" value="0" type="hidden">
<input name="f_gg_jumps" id="f_gg_jumps" value="0" type="hidden">
<input name="f_forwarder_1" id="f_forwarder_1" value="<?php p_dnsforw(0); ?>" type="hidden">
<input name="f_forwarder_2" id="f_forwarder_2" value="<?php p_dnsforw(1); ?>" type="hidden">
<input name="f_serving_zone" id="f_serving_zone" value="<?php p_srvzone() ?>" type="hidden">
<input name="f_local_domain" id="f_local_domain" value="<?php p_domain(); ?>" type="hidden">
<input name="f_redir_spf" id="f_redir_spf" value="<?php p_spfredir(); ?>" type="hidden">
<input name="f_spf_here" id="f_spf_here" value="<?php echo g_spfhere()? '1':'0'; ?>" type="hidden">
<input name="f_lan" id="f_lan" value="<?php echo g_lan(); ?>" type="hidden">
<input name="f_lan1" id="f_lan1" value="<?php echo g_lan1(); ?>" type="hidden">
<table id="topContainer">
<tr>
<td class="laCN">Project Page : <a href="<?php p_productHome(); ?>" target=_blank><?php p_serverName(); ?></a></td>
<td class="raCN">Version : <?php p_firmware("-ro");?> </td>
</tr>
</table>
<table id="topTable">
<tr>
<td id="topBarLeft"><a id="logo" href="<?php p_productHome(); ?>"></a></td>
<td id="topBarRight"></td>
</tr>
</table>
<table id="topMenuTable">
<tr>
<td class="ledPanel">
<img class="led" alt="fwstat" title="Firewall" src="/img/<?php echo g_srvstat("shorewall")? "on":"off" ?>.png">
<img class="led" alt="dnsstat" title="DNS" src="/img/<?php echo g_srvstat("named")? "on":"off" ?>.png">
<img class="led" alt="dhcpstat" title="DHCP" src="/img/<?php echo g_srvstat("dhcpd")? "on":"off" ?>.png">
</td>
<td class="topMenuLink"><a href="/network.php">Setup</a></td>
<td class="topMenuThis"><a href="/advanced.php">Advanced</a></td>
<td class="topMenuLink"><a href="/admin.php">MAINTENANCE</a></td>
<td class="topMenuLink"><a href="/status.php">Status</a></td>
<td class="topMenuLink"><a href="/logout.php"><span id="timer"></span></a></td>
</tr>
</table>
<table id="mainContentTable">
<tr style="vertical-align: top;">
<td class="leftMenyContatiner">
<div class="leftNavLink">
<ul style="width: 100%">
<li><div class="leftnavLink"><a href="/network.php">Network</a></div></li>
<?php if (g_haswifi()) { ?><li><div class="leftnavLink"><a href="/wireless.php">Wireless</a></div></li><?php }?>
<li><div class="leftnavLink"><a href="/dhcp.php">DHCP</a></div></li>
<li><div id="left" class="navThis">DNS</div></li>
<li><div class="leftnavLink"><a href="/firewall.php">Security</a></div></li>
</ul>
</div>
</td>
<td id="contentHeading">
<div id="contentBox">
<h1>DNS Settings</h1>
The Domain Name System (DNS) is responsible of assigning domain names and mapping those names
to IP addresses of devices on your LAN.
The DNS is maintained by a database residing on this <?php p_mode(); ?> to maintain local
addresses and names of your network devices.<br>
A DNS Server running on this <?php p_mode(); ?> is then linked to root DNS servers on the internet and thus this <?php p_mode(); ?> can serve your
LAN as the primary DNS Server with caching capabilities to reduce network traffic to the internet.
<br><br>
<input value="Save Settings" type="submit">
<input value="Don't Save Settings" onclick="cancelSettings()" type="button">
</div><div class="vbr"></div>
<div class="actionBox">
<h2 class="actionHeader">DNS Server Settings</h2>
<div id="show_dns_items">
<table>
<tr>
<td class="raCB" style="width: 40%">Local Domain Name :</td>
<td class="laCB">
<input <?php echo g_srvstat("dhcpd")? "disabled title='DHCP defined' ":"" ?> id="local_domain" size="16" maxlength="15" value="<?php p_domain(); ?>" type="text">
</td>
</tr>
<tr>
<td class="raCB">Serving local zone :</td>
<td class="laCB">
<input <?php echo g_srvstat("dhcpd")? "disabled title='DHCP defined' ":"" ?>id="serving_zone" size="16" maxlength="15" value="<?php p_srvzone() ?>" type="text">
</td>
</tr>
<tr>
<td class="raCB">Forwarding DNS Server 1 :</td>
<td class="laCB">
<input id="forwarder_1" size="16" maxlength="15" value="<?php p_dnsforw(0); ?>" type="text">
</td>
</tr>
<tr>
<td class="raCB">Forwarding DNS Server 2 :</td>
<td class="laCB">
<input id="forwarder_2" size="16" maxlength="15" value="<?php p_dnsforw(1); ?>" type="text">
</td>
</tr>
</table>
</div>
<table>
<tr>
<td class="raCB" style="text-align:right">
Enable DNS Server
<input type="checkbox" id="dns_enable" onChange="onchange_dns();"<?php echo g_srvstat("named")? ' checked="checked"':''; ?>>
</td>
</tr>
</table>
</div><div class="vbr"></div>
<div class="actionBox" id="show_spam_items">
<h2 class="actionHeader">URL Filtering</h2>
<table>
<tr>
<td class="raCB" style="width: 40%">Enable URL blacklist :</td>
<td><input id="do_spamft" onclick="check_spamft();" type="checkbox"<?php echo g_spamfmode()? ' checked="checked"':''; ?>></td>
</tr>
</table>
<div id="show_spam_features">
<table>
<tr>
<td class="raCB" style="width: 40%">Redirect blacklisted sites to I.P :</td>
<td>
<input id="redir_spf" size="16" title="<?php tt(1); ?>" maxlength="15" value="<?php p_spfredir(); ?>" type="text"> <b>On this <?php p_mode(); ?>:</b> <input id="spf_here" title="<?php tt(2); ?>" onclick="check_spfhere()" type="checkbox"<?php if(g_spfhere()) {echo " checked";} ?>>
</td>
</tr>
</table>
<div id="show_bl_options">
<table>
<tr><td class="raCB" style="width: 40%">Enable blacklist monthly updates :</td><td><input id="do_blu" onclick="check_blu();" type="checkbox"></td></tr>
<!-- <tr><td class="raCB">Enable Google tracking jump through : </td><td><input id="do_ggj" onclick="check_ggj();" type="checkbox"></td></tr> -->
</table>
</div>
</div>
</div><div class="vbr"></div>
<div class="actionBox" id="show_add_host">
<h2 class="actionHeader">Add a Host to Local Domain</h2>
<table>
<?php if (g_srvstat("dhcpd") == false) { ?>
<tr>
<td class="raCB" style="width: 40%">IP Address :</td>
<td class="laCB">
<input style="text-align:right;" id="res_ip" size="16" maxlength="20" value="" type="text">
</td>
<td>
<input type="button" value="Copy Your PC's IP Address" onclick="check_copy();">
</td>
</tr>
<tr>
<td class="raCB">Host Name :</td>
<td class="laCB" colspan="2">
<input style="text-align:right;" id="res_name" size="16" maxlength="20" value="" type="text">.<?php p_domain() ?>
<input id="res_indx" value="0" type="hidden">
</td>
</tr>
<tr>
<td colspan="3" style="text-align:right">
<input type="button" value="Add" onclick="check_res();">
</td>
</tr>
<?php } else { ?>
<tr>
<td class="laCB">
Your configuration dictates that host names and IP addresses are managed from the DHCP section.
Editing is permitted only when this <?php p_mode(); ?> provides the DNS service standalone.
</td>
</tr>
<?php }?>
</table>
</div><div class="vbr"></div>
<div class="actionBox" id="show_local_items" style="overflow-y:auto;max-height:500px;">
<h2 class="actionHeader">Local Domain hosts</h2>
<table id="restable">
<tr>
<td style="width:50%">Name</td>
<td style="width:50%">IP-Address</td>
<td<?php echo g_srvstat("dhcpd")==false? ' colspan="2"':""; ?>></td>
</tr>
<tr>
<td>
<input name="st_local_host_<?php echo $rowIndx ?>" value="1" type="hidden">
<input name="nm_local_host_<?php echo $rowIndx ?>" value="<?php p_nodeName(); ?>" type="hidden">
<input name="ip_local_host_<?php echo $rowIndx ?>" value="<?php p_srvip(); ?>" type="hidden">
<input disabled="disabled" size="10" maxlength="40" value="<?php p_nodeName(); ?>" type="text"> (this <?php p_mode(); ?><?php if (g_spfhere()) echo " with URL filter"; ?>)
</td>
<td>
<input disabled="disabled" size="12" maxlength="15" value="<?php p_srvip(); ?>" type="text">
<?php if (g_spfhere()) {
echo ' & <input disabled="disabled" size="12" value="'.g_spfredir().'" type="text">';
} ?>
</td>
<td<?php echo g_srvstat("dhcpd")==false? ' colspan="2"':""; ?>></td>
</tr>
<?php
$dstat=g_srvstat("dhcpd");
if (($fd = fopen("/tmp/dmlist", "r")) == NULL)
die("bummer");
$indx=++$rowIndx;
while (!feof($fd)) {
$str=trim(fgets($fd));
$a=preg_split("/,/", $str);
if (count($a) !=3) continue;
if ($a[2] == "1" && $dstat == false) continue;
$stat=$a[2]=="1"? "disabled":"";
$statval=$a[2]=="1"? "0":"1";
echo " <tr>\n";
echo " <td>\n";
echo ' <input name="st_local_host_'.$indx.'" id="st_local_host_'.$indx.'" value="'.$statval.'" type="hidden">'."\n";
echo ' <input readonly="readonly" name="nm_local_host_'.$indx.'" id="nm_local_host_'.$indx.'" style="width:100%;border:0;background-color:#dfdfdf" maxlength="40" value="'.$a[0].'" type="text">'."\n";
echo " </td>\n";
echo " <td>\n";
echo ' <input readonly="readonly" name="ip_local_host_'.$indx.'" id="ip_local_host_'.$indx.'" style="width:100%;border:0;background-color:#dfdfdf" maxlength="15" value="'.$a[1].'" type="text">'."\n";
echo " </td>\n";
if ($a[2] == "1") {
echo ' <td><img alt="dyn" src="/img/dyn.png" style="border:0"></td>'."\n";
} else {
if (g_srvstat("dhcpd") == false) {
echo ' <td><img alt="del" id="im_local_host_'.$indx.'" onclick="rm_row('.$indx.')" src="/img/delete.jpg" style="border:0"></td>'."\n";
echo ' <td><img alt="edit" onclick="ed_row('.$indx.')" src="/img/edit.jpg" style="border:0"></td>'."\n";
} else {
echo ' <td><img alt="fixed" src="/img/fixed.png" style="border:0"></td>'."\n";
}
}
echo " </tr>\n";
$indx++;
}
@fclose($fd);
?> </table>
</div>
</td>
<td id="quickHelpContent"><strong>Help...</strong><br>
<br>
Optionally this DNS server can act as a URL filter to block blacklisted sites on the internet by using a
list of known spam-and tracker sites on the internet.
<div id="show_bl_help" style="display:none"><br>
With the option "Enable blacklist monthly updates", the blacklist is regulary and
automatically updated from the internet from:<br>
<a style="color:#FFFFFF" href="http://pgl.yoyo.org/adservers/" target="_blank"><b>pgl.yoyo.org</b></a>
<!-- <br><br>The option "Enable Google tracking jump through" will attempt to bypass the
hidden trackers that the google search site imposes on sponsored links. --><br><br>
Monthly updates <!-- and "tracking jump through"-->are meaningsfull only when this <?php p_mode(); ?> is
the handler of blacklisted sites i.e, the "On this <?php p_mode(); ?>" feature must be checked.
</div>
<?php if (g_srvstat("dhcpd")) { ?><br><br>Local Domain Hosts marked as
<a><img style="background-color:#FFFFFF; height:12px; border:0" src="/img/dyn.png" alt="x"></a> are
dynamic I.P addresses managed by the DHCP server.<br>
The <a><img style="background-color:#FFFFFF; height:12px;border:0" alt="x" src="/img/fixed.png"></a> indicates a static IP DHCP reservation.<?php }?>
<br><br><b>NOTICE</b><br>In an established dhcp/dns environment it is highly inappropriate to change the policy of having the dhcp
service and the dns service working together or not.<br>
Changing the policy will probably mean lost DNS records or lost DHCP asignements or both.
</td>
</tr>
<tr>
<td colspan="3" id="footer">
Copyright © <?php p_copyRight(); ?>
</td>
</tr>
</table>
</form>
</body>
</html>