Project

General

Profile

Download (5.83 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/* $Id$ */
3
/*
4
	Copyright (C) 2008 Ermal Lu?i
5
	All rights reserved.
6

    
7
	Redistribution and use in source and binary forms, with or without
8
	modification, are permitted provided that the following conditions are met:
9

    
10
	1. Redistributions of source code must retain the above copyright notice,
11
	   this list of conditions and the following disclaimer.
12

    
13
	2. Redistributions in binary form must reproduce the above copyright
14
	   notice, this list of conditions and the following disclaimer in the
15
	   documentation and/or other materials provided with the distribution.
16

    
17
	THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
18
	INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
19
	AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
20
	AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
21
	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22
	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23
	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24
	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26
	POSSIBILITY OF SUCH DAMAGE.
27
*/
28
/*
29
	pfSense_BUILDER_BINARIES:	/usr/bin/host	
30
	pfSense_MODULE:	dyndns
31
*/
32

    
33
##|+PRIV
34
##|*IDENT=page-services-dynamicdnsclients
35
##|*NAME=Services: Dynamic DNS clients page
36
##|*DESCR=Allow access to the 'Services: Dynamic DNS clients' page.
37
##|*MATCH=services_dyndns.php*
38
##|-PRIV
39

    
40
require("guiconfig.inc");
41

    
42
if (!is_array($config['dyndnses']['dyndns']))
43
	$config['dyndnses']['dyndns'] = array();
44

    
45
$a_dyndns = &$config['dyndnses']['dyndns'];
46

    
47
if ($_GET['act'] == "del") {
48
		unset($a_dyndns[$_GET['id']]);
49

    
50
		write_config();
51

    
52
		header("Location: services_dyndns.php");
53
		exit;
54
}
55

    
56
$pgtitle = array("Services", "Dynamic DNS clients");
57
include("head.inc");
58

    
59
?>
60

    
61
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
62
<?php include("fbegin.inc"); ?>
63
<form action="services_dyndns.php" method="post" name="iform" id="iform">
64
<?php if ($input_errors) print_input_errors($input_errors); ?>
65
<table width="100%" border="0" cellpadding="0" cellspacing="0">
66
  <tr><td>
67
<?php
68
	$tab_array = array();
69
	$tab_array[] = array("DynDns", true, "services_dyndns.php");
70
	$tab_array[] = array("RFC 2136", false, "services_rfc2136.php");
71
	display_top_tabs($tab_array);
72
?>
73
  </td></tr>
74
  <tr>
75
    <td>
76
	<div id="mainarea">
77
	<table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
78
                <tr>
79
				  <td width="5%"  class="listhdrr"></td>
80
				  <td width="15%" class="listhdrr">Service</td>
81
                  <td width="20%" class="listhdrr">Hostname</td>
82
                  <td width="20%" class="listhdrr">Cached IP</td>
83
                  <td width="50%" class="listhdr">Description</td>
84
                  <td width="10%" class="list"></td>
85
				</tr>
86
			  <?php $i = 0; foreach ($a_dyndns as $dyndns): ?>
87
                <tr>
88
				  <td class="listlr">
89
				  <?php $iflist = get_configured_interface_with_descr();
90
				  		foreach ($iflist as $if => $ifdesc):
91
							if ($dyndns['interface'] == $if): ?>
92
								<?=$ifdesc; break;?>
93
					<?php endif; endforeach; ?>
94
				  </td>
95
                  <td class="listlr">
96
				  <?php
97
						$types = explode(",", "DNS-O-Matic, DynDNS (dynamic),DynDNS (static),DynDNS (custom),DHS,DyNS,easyDNS,No-IP,ODS.org,ZoneEdit,Loopia,freeDNS, DNSexit, OpenDNS");
98
						$vals = explode(" ", "dnsomatic dyndns dyndns-static dyndns-custom dhs dyns easydns noip ods zoneedit loopia freedns dnsexit opendns");
99
						$j = 0; for ($j = 0; $j < count($vals); $j++) 
100
                      				if ($vals[$j] == $dyndns['type']) { 
101
                      					echo htmlspecialchars($types[$j]);
102
											break;
103
									}
104
						?>
105
                  </td>
106
                  <td class="listr">
107
					<?=htmlspecialchars($dyndns['host']);?>
108
                  </td>
109
                  <td class="listlr">
110
					<?php
111
						$int = strtolower($if);
112
						$real_int = get_real_interface($if);
113
						$filename = "{$g['conf_path']}/dyndns_{$int}dyndns.cache";
114
						if(file_exists($filename)) {
115
							$dns_resolv = str_replace("\n", "", `/usr/bin/host {$dyndns['host']} | awk '{ print $4 }'`);
116
							$cached_ip_s = split(":", file_get_contents($filename));
117
							$cached_ip = $cached_ip_s[0];
118
							$int_ip = find_interface_ip($real_int);
119
							if($int_ip <> $cached_ip or $dns_resolv <> $int_ip) 
120
								echo "<font color='red'>";
121
							else 
122
								echo "<font color='green'>";
123
							echo htmlspecialchars($cached_ip);
124
							echo "</font>";
125
						} else {
126
							echo "N/A";
127
						}
128
					?>
129
				  </td>
130
                  <td class="listbg">
131
                    <?=htmlspecialchars($dyndns['descr']);?>&nbsp;
132
                  </td>
133
                  <td valign="middle" nowrap class="list"> <a href="services_dyndns_edit.php?id=<?=$i;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a>
134
                     &nbsp;<a href="services_dyndns.php?act=del&id=<?=$i;?>" onclick="return confirm('Do you really want to delete this VLAN?')"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a></td>
135
				</tr>
136
			  <?php $i++; endforeach; ?>
137
                <tr>
138
                  <td class="list" colspan="5"></td>
139
                  <td class="list"> <a href="services_dyndns_edit.php"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td>
140
				</tr>
141
				<tr>
142
				<td colspan="3" class="list"><p class="vexpl"><span class="red"><strong>
143
				  Note:<br>
144
				  </strong></span>
145
				  IP addresses appearing in green are up to date with Dynamic DNS provider.
146
				  </td>
147
				<td class="list">&nbsp;</td>
148
				</tr>
149
              </table>
150
	      </div>
151
	</td>
152
	</tr>
153
</table>
154
</form>
155
<?php include("fend.inc"); ?>
156
</body>
157
</html>
(134-134/217)