示例#1
0
    //checks
    if ($_POST['password1'] != $_POST['password2']) {
        $Result->show("danger", _("Passwords do not match"), true);
    }
    if (strlen($_POST['password1']) < 8) {
        $Result->show("danger", _("Password must be at least 8 characters long!"), true);
    }
    //hash passowrd
    $_POST['password1'] = $User->crypt_user_pass($_POST['password1']);
}
# general checks
if (strlen(@$_POST['real_name']) == 0) {
    $Result->show("danger", _("Real name field is mandatory!"), true);
}
# email format must be valid
if (!$Result->validate_email(@$_POST['email'])) {
    $Result->show("danger", _("Invalid email address!"), true);
}
# username must not already exist (if action is add)
if ($_POST['action'] == "add") {
    //username > 8 chars
    if ($auth_method->type == "local") {
        if (strlen($_POST['username']) < 6) {
            $Result->show("danger", _("Username must be at least 6 characters long!"), true);
        }
    } else {
        if (strlen($_POST['username']) == 0) {
            $Result->show("danger", _("Username must be at least 1 character long!"), true);
        }
    }
    //check duplicate
示例#2
0
             }
         }
     } else {
         if (!filter_var($_POST['master'], FILTER_VALIDATE_IP)) {
             $Result->show("danger", "Master must be an IP address" . " - " . $_POST['master'], true);
         }
     }
 }
 // type
 if (!in_array($_POST['type'], (array) $PowerDNS->domain_types)) {
     $Result->show("danger", "Invalid domain type", true);
 }
 # new domain
 if ($_POST['action'] == "add" && !isset($_POST['manual'])) {
     // admin
     if ($Result->validate_email($_POST['hostmaster']) === false) {
         $Result->show("danger", "Invalid domain hostmaster", true);
     }
 }
 // if slave master must be present
 if ($_POST['type'] == "SLAVE") {
     if (strlen($_POST['master']) == 0) {
         $Result->show("danger", "Please set master server(s) if domain type is SLAVE", true);
     } else {
         if (strpos($_POST['master'], ",") !== false) {
             // to array and trim, check each
             $masters = array_filter(explode(",", $_POST['master']));
             foreach ($masters as $m) {
                 if (!filter_var($m, FILTER_VALIDATE_IP)) {
                     $Result->show("danger", "Master must be an IP address" . " - " . $m, true);
                 }
示例#3
0
/* functions */
require dirname(__FILE__) . '/../../functions/functions.php';
/* @mail functions ------------------- */
require dirname(__FILE__) . '/../../functions/classes/class.Mail.php';
# initialize user object
$Database = new Database_PDO();
$Subnets = new Subnets($Database);
$Tools = new Tools($Database);
$Admin = new Admin($Database, false);
$Result = new Result();
# fetch settings, user is not authenticated !
$settings = $Tools->fetch_settings();
# requests must be enabled!
if ($settings['enableIPrequests'] == 1) {
    # verify email
    if (!$Result->validate_email($_POST['requester'])) {
        $Result->show("danger", _('Please provide valid email address') . '! (' . _('requester') . ': ' . $_POST['requester'] . ')', true);
    }
    # formulate insert values
    $values = array("subnetId" => $_POST['subnetId'], "ip_addr" => @$_POST['ip_addr'], "description" => @$_POST['description'], "dns_name" => @$_POST['dns_name'], "owner" => $_POST['owner'], "requester" => $_POST['requester'], "comment" => @$_POST['comment'], "processed" => 0);
    if (!$Admin->object_modify("requests", "add", "id", $values)) {
        $Result->show("danger", _('Error submitting new IP address request'), true);
    } else {
        $Result->show("success", _('Request submitted successfully'));
        # send mail
        //if(!sendIPReqEmail($_POST))									{ $Result->show("danger",  _('Sending mail for new IP request failed'), true); }
        //else														{ $Result->show("success", _('Sending mail for IP request succeeded'), true); }
    }
} else {
    $Result->show("danger", _('IP requests disabled'), true);
}