From e1a419ea117f6ea93fc2cfe3f559e914fe2a7c33 Mon Sep 17 00:00:00 2001 From: Marcus Hill Date: Mon, 7 Mar 2022 22:31:19 +0000 Subject: [PATCH] Refactor domains modals so they are dyanmically populated. Implement basic NS, MX and WHOIS scraping for domains on add/edit --- ajax.php | 22 +++++ client_domain_edit_modal.php | 162 ++++++++++++++++++++--------------- client_domains.php | 91 ++++++++++++++++++-- post.php | 30 ++++++- 4 files changed, 228 insertions(+), 77 deletions(-) diff --git a/ajax.php b/ajax.php index 07a56ad8..78c7c877 100644 --- a/ajax.php +++ b/ajax.php @@ -76,6 +76,28 @@ if(isset($_GET['certificate_get_json_details'])){ echo json_encode($response); } +/* + * Looks up info for a given domain ID from the database, used to dynamically populate modal fields + */ +if(isset($_GET['domain_get_json_details'])){ + $domain_id = intval($_GET['domain_id']); + $client_id = intval($_GET['client_id']); + + // Individual domain lookup + $cert_sql = mysqli_query($mysqli,"SELECT * FROM domains WHERE domain_id = $domain_id AND domain_client_id = $client_id"); + while($row = mysqli_fetch_array($cert_sql)){ + $response['domain'][] = $row; + } + + // Get all registrars/webhosts (vendors) for this client that could be linked to this domain + $vendor_sql = mysqli_query($mysqli, "SELECT vendor_id, vendor_name FROM vendors WHERE vendor_client_id = $client_id"); + while($row = mysqli_fetch_array($vendor_sql)){ + $response['vendors'][] = $row; + } + + echo json_encode($response); +} + /* * Looks up info on the ticket number provided, used to populate the ticket merge modal */ diff --git a/client_domain_edit_modal.php b/client_domain_edit_modal.php index 0f10ea49..5871abc9 100644 --- a/client_domain_edit_modal.php +++ b/client_domain_edit_modal.php @@ -1,82 +1,110 @@ -