$domain_id LIMIT 1")); if ($domain_row && $name !== '' && !$duplicate) { $before = domainHistorySnapshot($domain_id); $update_sql = mysqli_query($mysqli, "UPDATE domains SET domain_name = '$name', domain_description = '$description', domain_expire = $expire_sql, domain_auto_renew = $auto_renew, domain_notes = '$notes', domain_registrar = $registrar, domain_webhost = $webhost, domain_dnshost = $dnshost, domain_mailhost = $mailhost WHERE domain_id = $domain_id AND domain_client_id = $client_id AND domain_archived_at IS NULL LIMIT 1"); if ($update_sql) { // Capture the update result before any history or audit queries run. $update_count = mysqli_affected_rows($mysqli); // DNS and registration come from the domain itself; a lookup that finds nothing keeps what was there domainApplyLookup($domain_id, domainLookup($name)); domainWriteHistory($domain_id, $before, domainHistorySnapshot($domain_id)); logAudit("Domain", "Edit", "$name via API ($api_key_name)", $client_id, $domain_id); logAudit("API", "Success", "Updated domain $name via API ($api_key_name)", $client_id); } } } require_once '../update_output.php';