Alternc  3.2
Alternc logiel libre pour l'h├ębergement
 All Data Structures Namespaces Files Functions Variables Pages
adm_slavedns.php
Go to the documentation of this file.
1 <?php
2 /*
3  $Id: adm_slaveip.php,v 1.2 2004/06/02 13:03:13 anonymous Exp $
4  ----------------------------------------------------------------------
5  AlternC - Web Hosting System
6  Copyright (C) 2002 by the AlternC Development Team.
7  http://alternc.org/
8  ----------------------------------------------------------------------
9  Based on:
10  Valentin Lacambre's web hosting softwares: http://altern.org/
11  ----------------------------------------------------------------------
12  LICENSE
13 
14  This program is free software; you can redistribute it and/or
15  modify it under the terms of the GNU General Public License (GPL)
16  as published by the Free Software Foundation; either version 2
17  of the License, or (at your option) any later version.
18 
19  This program is distributed in the hope that it will be useful,
20  but WITHOUT ANY WARRANTY; without even the implied warranty of
21  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22  GNU General Public License for more details.
23 
24  To read the license please visit http://www.gnu.org/copyleft/gpl.html
25  ----------------------------------------------------------------------
26  Original Author of file: Benjamin Sonntag
27  Purpose of file: Manage list of allowed ip for zone transfers
28  ----------------------------------------------------------------------
29  */
30 require_once("../class/config.php");
31 
32 if (!$admin->enabled) {
33  __("This page is restricted to authorized staff");
34  exit();
35 }
36 
37 $fields = array (
38  "delaccount" => array ("request", "string", ""),
39  "newlogin" => array ("request", "string", ""),
40  "newpass" => array ("request", "string", ""),
41 
42  "delip" => array ("request", "string", ""),
43  "newip" => array ("request", "string", ""),
44  "newclass" => array ("request", "string", "32"),
45  );
47 
48 if ($delaccount) {
49  // Delete an account
50  if ($dom->del_slave_account($delaccount)) {
51  $error=_("The requested account has been deleted. It is now denied.");
52  }
53 }
54 if ($newlogin) {
55  // Add an account
56  if ($dom->add_slave_account($newlogin,$newpass)) {
57  $error=_("The requested account address has been created. It is now allowed.");
58  unset($newlogin); unset($newpass);
59  }
60 }
61 
62 if ($delip) {
63  // Delete an ip address/class
64  if ($dom->del_slave_ip($delip)) {
65  $error=_("The requested ip address has been deleted. It will be denied in one hour.");
66  }
67 }
68 if ($newip) {
69  // Add an ip address/class
70  if ($dom->add_slave_ip($newip,$newclass)) {
71  $error=_("The requested ip address has been added to the list. It will be allowed in one hour.");
72  unset($newip); unset($newclass);
73  }
74 }
75 
76 include_once("head.php");
77 
78 if (!empty($error)) {
79  echo "<p class=\"alert alert-danger\">$error</p>";
80 }
81 
82 ?>
83 <h3><?php __("Manage allowed ip for slave zone transfers"); ?></h3>
84 <hr id="topbar" />
85 <?php
86 
87 $c=$dom->enum_slave_ip();
88 
89 if (is_array($c)) { ?>
90  <p>
91  <?php __("Here is the list of the allowed ip or ip class for slave dns zone transfer requests (AXFR). You must add the ip address of all the slave DNS you have so that those slaves will be allowed to transfer the zone files. There is also some defaults ip from DNS checks made by some third-party technical offices such as afnic (for .fr domains)"); ?>
92  </p>
93 
94  <table border="0" cellpadding="4" cellspacing="0" class='tlist'>
95  <tr><th><?php __("Action"); ?></th><th><?php __("IP Address"); ?></th></tr>
96  <?php
97  for($i=0;$i<count($c);$i++) {
98  ?>
99 
100  <tr class="lst">
101  <td class="center"><div class="ina delete"><a href="adm_slavedns.php?delip=<?php echo urlencode($c[$i]['ip']); ?>"><?php __("Delete"); ?></a></div></td>
102  <td><?php echo $c[$i]["ip"]."/".$c[$i]["class"]; ?></td>
103  </tr>
104  <?php
105  } //for
106  ?>
107  </table>
108 <?php } // is_array ($c) ?>
109 
110 <p><?php __("If you want to allow an ip address or class to connect to your dns server, enter it here. Choose 32 as a prefix for single ip address."); ?></p>
111 
112 <form method="post" action="adm_slavedns.php" name="main" id="main">
113  <table class="tedit">
114  <tr><th><label for="newip"><?php __("IP Address"); ?></label></th><th><label for="newclass"><?php __("Prefix"); ?></label></th></tr>
115  <tr>
116  <td style="text-align: right"><input type="text" class="int" value="<?php ehe( (isset($newip)?$newip:'') ); ?>" id="newip" name="newip" maxlength="15" size="20" style="text-align:right" /> / </td>
117  <td><input type="text" class="int" value="<?php ehe( (isset($newclass)?$newclass:'') ); ?>" id="newclass" name="newclass" maxlength="2" size="3" /></td>
118  </tr>
119  <tr>
120  <td colspan="2"><input type="submit" value="<?php __("Add this ip to the slave list"); ?>" class="inb" /></td>
121  </tr>
122  </table>
123 </form>
124 
125 <br/>
126 <br/>
127 <hr/>
128 
129 <h3><?php __("Manage allowed accounts for slave zone transfers"); ?></h3>
130 <hr id="topbar"/>
131 <br />
132 
133 <?php
134 $c=$dom->enum_slave_account();
135 
136 if (is_array($c)) { ?>
137  <p><?php __("Here is the list of the allowed accounts for slave dns synchronization. You can configure the alternc-slavedns package on your slave server and give him the login/pass that will grant him access to your server's domain list. "); ?></p>
138 
139  <table class="tlist">
140  <tr><th><?php __("Action"); ?></th><th><?php __("Login"); ?></th><th><?php __("Password"); ?></th></tr>
141  <?php
142  for($i=0;$i<count($c);$i++) { ?>
143 
144  <tr class="lst">
145  <td class="center"><div class="ina delete"><a href="adm_slavedns.php?delaccount=<?php echo urlencode($c[$i]["login"]); ?>"><?php __("Delete"); ?></a></div></td>
146  <td><?php ehe($c[$i]["login"]); ?></td>
147  <td><?php ehe($c[$i]["pass"]); ?></td>
148  </tr>
149  <?php
150  } // for ?>
151 </table>
152 <?php } // is_array ?>
153 
154 <p><?php __("If you want to allow a new server to access your domain list, give him an account."); ?></p>
155 
156 <form method="post" action="adm_slavedns.php" name="main" id="main">
157  <table class="tedit">
158  <tr><th><label for="newlogin"><?php __("Login"); ?></label></th><th><label for="newpass"><?php __("Password"); ?></label></th></tr>
159  <tr>
160  <td><input type="text" class="int" value="<?php ehe( isset($newlogin)?$newlogin:'') ; ?>" id="newlogin" name="newlogin" maxlength="64" size="32" /><br/><br/></td>
161  <td><input type="password" class="int" value="<?php ehe( (isset($newpass)?$newpass:'') ) ; ?>" id="newpass" name="newpass" maxlength="64" size="32" /><?php display_div_generate_password(DEFAULT_PASS_SIZE,"#newpass"); ?></td>
162  </tr>
163  <tr class="trbtn"><td colspan="2"><input type="submit" value="<?php __("Add this account to the allowed list"); ?>" class="inb" /></td></tr>
164  </table>
165 </form>
166 
167 <script type="text/javascript">
168  document.forms['main'].setAttribute('autocomplete', 'off');
169  document.forms['main'].newip.focus();
170 $(function(){
171  $(".toggle-next").on("click",function(){
172 
173  var next = $(this).next();
174  next.toggle();
175  })
176 
177 });
178 </script>
179 
180 <style>
181 
182 .info {
183  background: none repeat scroll 0 0 white;
184  border: 1px solid #CCCCCC;
185  border-radius: 15px 15px 15px 15px;
186  margin: 16px 0;
187  padding: 0 16px;
188 }
189 .info-hide{
190 display:none;
191 }
192 </style>
193 <div class="info">
194 <h4 class="toggle toggle-next"><a href="javascript:void(0)" class="btn"> <?= _("Need open DNS Slave servers?")?> &#9660;</a></h4>
195 <div class="info-hide">
196 <p><?= _("We offer free of charge DNS servers for alternc users."); ?></p>
197 <h2><?= _("How does it work?") ?> </h2>
198 <ol>
199  <li><?= sprintf(_("<strong>Give access to the alternc.net servers.</strong> Follow the instructions on <a href='%s' target='blank'>this page</a>. They will help you to configure this page and configure your alternc.net account."),"http://aide-alternc.org/go.php?hid=400") ?></li>
200  <li><?= sprintf(_("<strong>Subscribe to alternc.net.</strong> Go to <a href='%s' target='_blank' class='btn btn-inline btn-link'>the alternc.net site</a> to use the DNS servers provided for free by the AlternC association and enter the required informations for each server you want to connect to the service."),"http://alternc.net/")?> </li>
201 </ol>
202 <br />
203 <p><?= _("The alternc.net servers will take care of transfering and distributing to the world your domains zones.") ?> </p>
204 </div><!-- info-hide -->
205 </div><!-- info -->
206 <?php include_once("foot.php"); ?>