diff -r c72d6d51f3d3 -r c255196bc447 add_supermaster.php --- a/add_supermaster.php Wed Mar 12 20:45:56 2008 +0000 +++ b/add_supermaster.php Tue Mar 25 22:45:31 2008 +0000 @@ -20,82 +20,68 @@ */ require_once("inc/toolkit.inc.php"); +include_once("inc/header.inc.php"); -if (!level(5)) -{ - error(ERR_LEVEL_5); -} +$master_ip = $_POST["master_ip"]; +$ns_name = $_POST["ns_name"]; +$account = $_POST["account"]; -if(isset($_POST["submit"])) +(verify_permission(supermaster_add)) ? $supermasters_add = "1" : $supermasters_add = "0"; + +if($_POST["submit"]) { - $master_ip = (isset($_POST['master_ip']) ? $_POST["master_ip"] : ''); - $ns_name = (isset($_POST['ns_name']) ? $_POST["ns_name"] : ''); - $account = (isset($_POST["account"]) ? $_POST['account'] : ''); - if (!isset($error)) - { - if (!is_valid_ip($master_ip) && !is_valid_ip6($master_ip)) - { - $error = _('Given master IP address is not valid IPv4 or IPv6.'); - } - elseif (!is_valid_hostname($ns_name)) - { - $error = _('Given hostname for NS record not valid.'); - } - elseif (!validate_account($account)) - { - $error = _('Account name is not valid (may contain only alpha chars).'); - } - else - { - if(add_supermaster($master_ip, $ns_name, $account)) - { - $success = _('Successfully added supermaster.'); - } - } + if (add_supermaster($master_ip, $ns_name, $account)) { + echo "
" . _("You do not have the permission to add a new supermaster.") . "
\n"; +} else { + echo " \n"; +} include_once("inc/footer.inc.php"); ?>