Add notes to domains

This commit is contained in:
Marcus Hill 2023-12-31 11:13:48 +00:00
parent 1a1b4ee810
commit d3b59edfe4
4 changed files with 33 additions and 18 deletions

View File

@ -73,7 +73,13 @@
</div>
</div>
<div class="form-group">
<label>Notes</label>
<textarea class="form-control" rows="3" placeholder="Enter some notes" name="notes"></textarea>
</div>
</div>
<div class="modal-footer bg-white">
<button type="submit" name="add_domain" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Create</button>
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>

View File

@ -2,7 +2,7 @@
<div class="modal-dialog">
<div class="modal-content bg-dark">
<div class="modal-header">
<h5 class="modal-title"><i class="fa fa-fw fa-globe mr-2"></i>Editing domain: <span class="text-bold" id="editHeader"></span></h5>
<h5 class="modal-title"><i class="fa fa-fw fa-globe mr-2"></i>Editing domain: <span class="text-bold" id="editDomainHeader"></span></h5>
<button type="button" class="close text-white" data-dismiss="modal">
<span>&times;</span>
</button>
@ -43,7 +43,7 @@
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-fw fa-server"></i></span>
</div>
<select class="form-control select2" name="registrar" id="editRegistrarId">
<select class="form-control select2" name="registrar" id="editDomainRegistrarId">
</select>
</div>
</div>
@ -54,7 +54,7 @@
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-fw fa-server"></i></span>
</div>
<select class="form-control select2" name="webhost" id="editWebhostId">
<select class="form-control select2" name="webhost" id="editDomainWebhostId">
</select>
</div>
</div>
@ -65,10 +65,15 @@
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-fw fa-calendar-times"></i></span>
</div>
<input type="date" class="form-control" id="editExpire" name="expire" max="2999-12-31">
<input type="date" class="form-control" name="expire" id="editDomainExpire" max="2999-12-31">
</div>
</div>
<div class="form-group">
<label>Notes</label>
<textarea class="form-control" rows="3" placeholder="Enter some notes" name="notes" id="editDomainNotes"></textarea>
</div>
</div>
<div class="tab-pane fade" id="pills-records">
@ -89,7 +94,7 @@
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-fw fa-crown"></i></span>
</div>
<textarea class="form-control" id="editNameServers" name="name_servers" rows="1" disabled></textarea>
<textarea class="form-control" id="editDomainNameServers" name="name_servers" rows="1" disabled></textarea>
</div>
</div>
@ -99,7 +104,7 @@
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-fw fa-mail-bulk"></i></span>
</div>
<textarea class="form-control" id="editMailServers" name="mail_servers" rows="1" disabled></textarea>
<textarea class="form-control" id="editDomainMailServers" name="mail_servers" rows="1" disabled></textarea>
</div>
</div>
@ -109,7 +114,7 @@
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-fw fa-check-double"></i></span>
</div>
<textarea class="form-control" id="editTxtRecords" name="txt_records" rows="1" disabled></textarea>
<textarea class="form-control" id="editDomainTxtRecords" name="txt_records" rows="1" disabled></textarea>
</div>
</div>
@ -119,7 +124,7 @@
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-fw fa-search-plus"></i></span>
</div>
<textarea class="form-control" id="editRawWhois" name="raw_whois" rows="6" disabled></textarea>
<textarea class="form-control" id="editDomainRawWhois" name="raw_whois" rows="6" disabled></textarea>
</div>
</div>

View File

@ -14,20 +14,21 @@ function populateDomainEditModal(client_id, domain_id) {
const vendors = response.vendors;
// Populate the domain modal fields
document.getElementById("editHeader").innerText = domain.domain_name;
document.getElementById("editDomainHeader").innerText = domain.domain_name;
document.getElementById("editDomainId").value = domain_id;
document.getElementById("editDomainName").value = domain.domain_name;
document.getElementById("editExpire").value = domain.domain_expire;
document.getElementById("editDomainExpire").value = domain.domain_expire;
document.getElementById("editDomainNotes").value = domain.domain_notes;
document.getElementById("editDomainIP").value = domain.domain_ip;
document.getElementById("editNameServers").value = domain.domain_name_servers;
document.getElementById("editMailServers").value = domain.domain_mail_servers;
document.getElementById("editTxtRecords").value = domain.domain_txt;
document.getElementById("editRawWhois").value = domain.domain_raw_whois;
document.getElementById("editDomainNameServers").value = domain.domain_name_servers;
document.getElementById("editDomainMailServers").value = domain.domain_mail_servers;
document.getElementById("editDomainTxtRecords").value = domain.domain_txt;
document.getElementById("editDomainRawWhois").value = domain.domain_raw_whois;
/* DROPDOWNS */
// Registrar dropdown
var registrarDropdown = document.getElementById("editRegistrarId");
var registrarDropdown = document.getElementById("editDomainRegistrarId");
// Clear registrar dropdown
var i, L = registrarDropdown.options.length -1;
@ -48,7 +49,7 @@ function populateDomainEditModal(client_id, domain_id) {
});
// Webhost dropdown
var webhostDropdown = document.getElementById("editWebhostId");
var webhostDropdown = document.getElementById("editDomainWebhostId");
// Clear registrar dropdown
var i, L = webhostDropdown.options.length -1;

View File

@ -14,6 +14,8 @@ if (isset($_POST['add_domain'])) {
$webhost = intval($_POST['webhost']);
$extended_log_description = '';
$expire = sanitizeInput($_POST['expire']);
$notes = sanitizeInput($_POST['notes']);
if (empty($expire)) {
$expire = "NULL";
} else {
@ -35,7 +37,7 @@ if (isset($_POST['add_domain'])) {
$whois = sanitizeInput($records['whois']);
// Add domain record
mysqli_query($mysqli,"INSERT INTO domains SET domain_name = '$name', domain_registrar = $registrar, domain_webhost = $webhost, domain_expire = $expire, domain_ip = '$a', domain_name_servers = '$ns', domain_mail_servers = '$mx', domain_txt = '$txt', domain_raw_whois = '$whois', domain_client_id = $client_id");
mysqli_query($mysqli,"INSERT INTO domains SET domain_name = '$name', domain_registrar = $registrar, domain_webhost = $webhost, domain_expire = $expire, domain_ip = '$a', domain_name_servers = '$ns', domain_mail_servers = '$mx', domain_txt = '$txt', domain_raw_whois = '$whois', domain_notes = '$notes', domain_client_id = $client_id");
// Get inserted ID (for linking certificate, if exists)
@ -70,6 +72,7 @@ if (isset($_POST['edit_domain'])) {
$registrar = intval($_POST['registrar']);
$webhost = intval($_POST['webhost']);
$expire = sanitizeInput($_POST['expire']);
$notes = sanitizeInput($_POST['notes']);
if (empty($expire) || (new DateTime($expire)) < (new DateTime())) {
// Update domain expiry date
@ -86,7 +89,7 @@ if (isset($_POST['edit_domain'])) {
$txt = sanitizeInput($records['txt']);
$whois = sanitizeInput($records['whois']);
mysqli_query($mysqli,"UPDATE domains SET domain_name = '$name', domain_registrar = $registrar, domain_webhost = $webhost, domain_expire = '$expire', domain_ip = '$a', domain_name_servers = '$ns', domain_mail_servers = '$mx', domain_txt = '$txt', domain_raw_whois = '$whois' WHERE domain_id = $domain_id");
mysqli_query($mysqli,"UPDATE domains SET domain_name = '$name', domain_registrar = $registrar, domain_webhost = $webhost, domain_expire = '$expire', domain_ip = '$a', domain_name_servers = '$ns', domain_mail_servers = '$mx', domain_txt = '$txt', domain_raw_whois = '$whois', domain_notes = '$notes' WHERE domain_id = $domain_id");
//Logging
mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Domain', log_action = 'Modify', log_description = '$session_name modified domain $name', log_ip = '$session_ip', log_user_agent = '$session_user_agent', log_client_id = $client_id, log_user_id = $session_user_id, log_entity_id = $domain_id");