13
+ − 1
<?php
47
+ − 2
+ − 3
/* PowerAdmin, a friendly web-based admin tool for PowerDNS.
+ − 4
* See <https://rejo.zenger.nl/poweradmin> for more details.
+ − 5
*
+ − 6
* Copyright 2007, 2008 Rejo Zenger <rejo@zenger.nl>
+ − 7
*
+ − 8
* This program is free software: you can redistribute it and/or modify
+ − 9
* it under the terms of the GNU General Public License as published by
+ − 10
* the Free Software Foundation, either version 3 of the License, or
+ − 11
* (at your option) any later version.
+ − 12
*
+ − 13
* This program is distributed in the hope that it will be useful,
+ − 14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
+ − 15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ − 16
* GNU General Public License for more details.
+ − 17
*
+ − 18
* You should have received a copy of the GNU General Public License
+ − 19
* along with this program. If not, see <http://www.gnu.org/licenses/>.
+ − 20
*/
+ − 21
13
+ − 22
require_once ( "inc/toolkit.inc.php" );
+ − 23
+ − 24
if ( ! level ( 5 ))
+ − 25
{
+ − 26
error ( ERR_LEVEL_5 );
+ − 27
}
+ − 28
+ − 29
if ( $_POST [ "submit" ])
+ − 30
{
+ − 31
$master_ip = $_POST [ "master_ip" ];
+ − 32
$ns_name = $_POST [ "ns_name" ];
+ − 33
$account = $_POST [ "account" ];
+ − 34
if ( ! $error )
+ − 35
{
+ − 36
if ( ! is_valid_ip ( $master_ip ) && ! is_valid_ip6 ( $master_ip ))
+ − 37
{
+ − 38
$error = _ ( 'Given master IP address is not valid IPv4 or IPv6.' );
+ − 39
}
+ − 40
elseif ( ! is_valid_hostname ( $ns_name ))
+ − 41
{
+ − 42
$error = _ ( 'Given hostname for NS record not valid.' );
+ − 43
}
+ − 44
elseif ( ! validate_account ( $account ))
+ − 45
{
+ − 46
$error = _ ( 'Account name is not valid (may contain only alpha chars).' );
+ − 47
}
+ − 48
else
+ − 49
{
+ − 50
if ( add_supermaster ( $master_ip , $ns_name , $account ))
+ − 51
{
+ − 52
$success = _ ( 'Successfully added supermaster.' );
+ − 53
}
+ − 54
}
+ − 55
}
+ − 56
}
+ − 57
+ − 58
include_once ( "inc/header.inc.php" );
+ − 59
+ − 60
if ( $error != "" )
+ − 61
{
71
+ − 62
?> <div class="error"> <?php echo _ ( 'Error' ); ?> : <?php echo $error ; ?> </div> <?php
13
+ − 63
}
+ − 64
elseif ( $success != "" )
+ − 65
{
71
+ − 66
?> <div class="success"> <?php echo $success ; ?> </div> <?php
13
+ − 67
}
+ − 68
+ − 69
?>
71
+ − 70
<h2> <?php echo _ ( 'Add supermaster' ); ?> </h2>
13
+ − 71
<form method="post" action="add_supermaster.php">
+ − 72
<table>
+ − 73
<tr>
71
+ − 74
<td class="n"> <?php echo _ ( 'IP address of supermaster' ); ?> :</td>
13
+ − 75
<td class="n">
71
+ − 76
<input type="text" class="input" name="master_ip" value=" <?php if ( $error ) print $_POST [ "master_ip" ]; ?> ">
13
+ − 77
</td>
+ − 78
</tr>
+ − 79
<tr>
71
+ − 80
<td class="n"> <?php echo _ ( 'Hostname in NS record' ); ?> :</td>
13
+ − 81
<td class="n">
71
+ − 82
<input type="text" class="input" name="ns_name" value=" <?php if ( $error ) print $_POST [ "ns_name" ]; ?> ">
13
+ − 83
</td>
+ − 84
</tr>
+ − 85
<tr>
71
+ − 86
<td class="n"> <?php echo _ ( 'Account' ); ?> :</td>
13
+ − 87
<td class="n">
71
+ − 88
<input type="text" class="input" name="account" value=" <?php if ( $error ) print $_POST [ "account" ]; ?> ">
13
+ − 89
</td>
+ − 90
</tr>
+ − 91
<tr>
+ − 92
<td class="n"> </td>
+ − 93
<td class="n">
71
+ − 94
<input type="submit" class="button" name="submit" value=" <?php echo _ ( 'Add supermaster' ); ?> ">
13
+ − 95
</td>
+ − 96
</tr>
+ − 97
</table>
+ − 98
</form>
71
+ − 99
<?php
13
+ − 100
include_once ( "inc/footer.inc.php" );
+ − 101
?>