add_supermaster.php
author rejo
Thu, 27 Mar 2008 20:40:42 +0000
changeset 102 f6d414c0ce89
parent 82 c255196bc447
child 110 455405c757e1
permissions -rw-r--r--
[feladat @ 202] Changed field type for password entry field in 'add user' window from text to password. Now password is no longer shown in plain tekst.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
13
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
     1
<?php
47
ae140472d97c [feladat @ 94]
rejo
parents: 13
diff changeset
     2
ae140472d97c [feladat @ 94]
rejo
parents: 13
diff changeset
     3
/*  PowerAdmin, a friendly web-based admin tool for PowerDNS.
ae140472d97c [feladat @ 94]
rejo
parents: 13
diff changeset
     4
 *  See <https://rejo.zenger.nl/poweradmin> for more details.
ae140472d97c [feladat @ 94]
rejo
parents: 13
diff changeset
     5
 *
ae140472d97c [feladat @ 94]
rejo
parents: 13
diff changeset
     6
 *  Copyright 2007, 2008  Rejo Zenger <rejo@zenger.nl>
ae140472d97c [feladat @ 94]
rejo
parents: 13
diff changeset
     7
 *
ae140472d97c [feladat @ 94]
rejo
parents: 13
diff changeset
     8
 *  This program is free software: you can redistribute it and/or modify
ae140472d97c [feladat @ 94]
rejo
parents: 13
diff changeset
     9
 *  it under the terms of the GNU General Public License as published by
ae140472d97c [feladat @ 94]
rejo
parents: 13
diff changeset
    10
 *  the Free Software Foundation, either version 3 of the License, or
ae140472d97c [feladat @ 94]
rejo
parents: 13
diff changeset
    11
 *  (at your option) any later version.
ae140472d97c [feladat @ 94]
rejo
parents: 13
diff changeset
    12
 *
ae140472d97c [feladat @ 94]
rejo
parents: 13
diff changeset
    13
 *  This program is distributed in the hope that it will be useful,
ae140472d97c [feladat @ 94]
rejo
parents: 13
diff changeset
    14
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
ae140472d97c [feladat @ 94]
rejo
parents: 13
diff changeset
    15
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
ae140472d97c [feladat @ 94]
rejo
parents: 13
diff changeset
    16
 *  GNU General Public License for more details.
ae140472d97c [feladat @ 94]
rejo
parents: 13
diff changeset
    17
 *
ae140472d97c [feladat @ 94]
rejo
parents: 13
diff changeset
    18
 *  You should have received a copy of the GNU General Public License
ae140472d97c [feladat @ 94]
rejo
parents: 13
diff changeset
    19
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
ae140472d97c [feladat @ 94]
rejo
parents: 13
diff changeset
    20
 */
ae140472d97c [feladat @ 94]
rejo
parents: 13
diff changeset
    21
13
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    22
require_once("inc/toolkit.inc.php");
82
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    23
include_once("inc/header.inc.php");
13
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    24
82
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    25
$master_ip = $_POST["master_ip"];
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    26
$ns_name = $_POST["ns_name"];
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    27
$account = $_POST["account"];
13
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    28
82
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    29
(verify_permission(supermaster_add)) ? $supermasters_add = "1" :  $supermasters_add = "0";
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    30
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    31
if($_POST["submit"])
13
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    32
{
82
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    33
	if (add_supermaster($master_ip, $ns_name, $account)) {
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    34
		echo "     <div class=\"success\">" .  _('Successfully added supermaster.') . "</div>\n";
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    35
	} else {
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    36
		$error = "1";
13
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    37
	}
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    38
}
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    39
82
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    40
echo "     <h2>" . _('Add supermaster') . "</h2>\n";
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    41
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    42
if ( $supermasters_add != "1" ) {
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    43
	echo "     <p>" . _("You do not have the permission to add a new supermaster.") . "</p>\n"; 
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    44
} else {
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    45
	echo "     <form method=\"post\" action=\"add_supermaster.php\">\n";
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    46
	echo "      <table>\n";
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    47
	echo "       <tr>\n";
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    48
	echo "        <td class=\"n\">" . _('IP address of supermaster') . "</td>\n";
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    49
	echo "        <td class=\"n\">\n";
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    50
	if ($error) {
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    51
		echo "         <input type=\"text\" class=\"input\" name=\"master_ip\" value=\"" . $master_ip . "\">\n";
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    52
	} else {
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    53
		echo "         <input type=\"text\" class=\"input\" name=\"master_ip\" value=\"\">\n";
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    54
	}
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    55
	echo "        </td>\n";
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    56
	echo "       </tr>\n";
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    57
	echo "       <tr>\n";
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    58
	echo "        <td class=\"n\">" . _('Hostname in NS record') . "</td>\n";
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    59
	echo "        <td class=\"n\">\n";
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    60
	if ($error) {
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    61
		echo "         <input type=\"text\" class=\"input\" name=\"ns_name\" value=\"" . $ns_name . "\">\n";
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    62
	} else {
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    63
		echo "         <input type=\"text\" class=\"input\" name=\"ns_name\" value=\"\">\n";
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    64
	}
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    65
	echo "        </td>\n";
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    66
	echo "       </tr>\n";
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    67
	echo "       <tr>\n";
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    68
	echo "        <td class=\"n\">" . _('Account') . "</td>\n";
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    69
	echo "        <td class=\"n\">\n";
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    70
	if ($error) {
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    71
		echo "         <input type=\"text\" class=\"input\" name=\"account\" value=\"" . $account . "\">\n";
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    72
	} else {
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    73
		echo "         <input type=\"text\" class=\"input\" name=\"account\" value=\"\">\n";
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    74
	}
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    75
	echo "        </td>\n";
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    76
	echo "       </tr>\n";
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    77
	echo "       <tr>\n";
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    78
	echo "        <td class=\"n\">&nbsp;</td>\n";
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    79
	echo "        <td class=\"n\">\n";
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    80
	echo "         <input type=\"submit\" class=\"button\" name=\"submit\" value=\"" . _('Add supermaster') . "\">\n";
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    81
	echo "        </td>\n";
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    82
	echo "       </tr>\n";
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    83
	echo "      </table>\n";
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    84
	echo "     </form>\n";
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    85
}
13
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    86
include_once("inc/footer.inc.php");
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    87
?>