예제 #1
0
function domain_taken($domain)
{
    global $TLD, $user, $userkey, $tld_svr, $specialNamesOpenNIC, $specialNamesRFC6761, $specialNamesIANA, $specialNamesDNS;
    if (preg_match($specialNamesOpenNIC, $domain) || preg_match($specialNamesRFC6761, $domain) || preg_match($specialNamesIANA, $domain) || preg_match($specialNamesDNS, $domain)) {
        return true;
    }
    // user is trying to take an special name
    $results = database_pdo_query("SELECT * FROM domains WHERE domain='{$domain}' LIMIT 1");
    if ($results['domain'] == $domain) {
        return 1;
    } else {
        return 0;
    }
}
예제 #2
0
function update_domain($domain, $ns1, $ns2, $ns1_ip, $ns2_ip, $mx1, $dskey, $txt, $isns)
{
    global $TLD, $tld_db, $domain_table;
    show_header();
    if (!validateIPAddress($ns1_ip) || !validateIPAddress($ns2_ip)) {
        echo "IP Addresses must be a valid IPv4 or IPv6 address\nIPv6 addresses must be in long form: do not use :: to omit 0'd hextets";
        die;
    }
    if (!validateFQDN($ns1, $domain) || !validateFQDN($ns2, $domain) || !validateFQDN($mx1, "")) {
        echo "All hostnames must be in FQDN form, including the .{$TLD}<br>The server hostname(s) must match the domain.";
        die;
    }
    if (!validateDSKEY($dskey)) {
        echo "Your DSkey is invalid<br>";
        die;
    }
    if (!validateTXT($txt)) {
        echo "Your site description contains invalid characters<br>";
        die;
    }
    if ($isns != 0 && $isns != 1) {
        echo "something has gone badly wrong.  Please report to the admin that 'isns' is not a 1 or 0.";
        die;
    }
    $updated = strftime('%Y-%m-%d');
    $userid = $_SESSION['userid'];
    $arr = database_pdo_query("SELECT * FROM {$domain_table} WHERE userid='{$userid}' AND domain='{$domain}' LIMIT 1");
    $real_userid = $arr['userid'];
    if ($userid != $real_userid) {
        echo "<font color=\"#ff0000\"><b>Error: You do not have permission to modify this domain.</b></font>";
        die;
    }
    echo "Updating " . $domain . '.' . $TLD . "...";
    $ret_data = database_pdo_query("UPDATE domains SET ns1='{$ns1}', ns2='{$ns2}', updated='{$updated}', ns1_ip='{$ns1_ip}', ns2_ip='{$ns2_ip}', mx1='{$mx1}', dskey='{$dskey}', txt='{$txt}',  isns='{$isns}' WHERE domain='{$domain}' AND userid='{$userid}'");
    echo "Done. The changes should take effect within the hour. Please be aware some networks may not see the changes for up to 72 hours.<BR>";
}
예제 #3
0
function update_account($password, $pgpkey)
{
    global $user_table;
    show_header();
    $changed = 0;
    if (!isset($_SESSION['userid'])) {
        echo "No valid account.";
        die;
    }
    if (!validatePGP($pgpkey)) {
        echo "Invalid PGP key<br>";
        die;
    }
    $userid = $_SESSION['userid'];
    if (strlen($password) > 0) {
        $password = htmlspecialchars(stripslashes($password));
        $real_password = hash('sha256', $password);
        $pass_ret = database_pdo_query("UPDATE {$user_table} SET password='******' WHERE userid='{$userid}'");
        $changed = 1;
    }
    if (strlen($pgpkey) > 0) {
        if (!validatePGP($pgpkey)) {
            echo "Invalid PGP key<br>";
            die;
        }
        $pgp_ret = database_pdo_query("UPDATE {$user_table} SET pgpkey='{$pgpkey}' WHERE userid='{$userid}'");
        $changed = 1;
    }
    if ($changed == 1) {
        echo "Details updated.";
    } else {
        echo "Nothing was changed.";
    }
}