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>"; }
function update_domain($domain, $ns1, $ns2, $ns1_ip, $ns2_ip) { global $TLD, $tld_db; show_header(); $updated = strftime('%Y-%m-%d'); $userid = $_SESSION['userid']; $base = database_open_now($tld_db, 0666); $query = "SELECT userid FROM domains WHERE userid='" . $userid . "' AND domain='" . $domain . "' LIMIT 1"; $results = database_query_now($base, $query); $arr = database_fetch_array_now($results); $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 . "..."; if ($ns1_ip != "NULL" && $ns2_ip != "NULL") { if (!validateIPAddress($ns1_ip) && !validateIPAddress($ns2_ip)) { echo "Error. NS1 and NS2 custom nameservers must be IP addresses."; } else { $query = "UPDATE domains SET ns1='" . $ns1 . "', ns2='" . $ns2 . "', ns1_ip='" . $ns1_ip . "', ns2_ip='" . $ns2_ip . "', updated='" . $updated . "' WHERE domain='" . $domain . "'"; } } else { $query = "UPDATE domains SET ns1='" . $ns1 . "', ns2='" . $ns2 . "', updated='" . $updated . "' WHERE domain='" . $domain . "'"; } database_query_now($base, $query); 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>"; if ($ns1 == $ns2) { echo "<b>Please Note:</b> We highly recommend that you use two different nameserver values instead of the same one."; } }