Jump to content

Working Multiple TLD Queries


Recommended Posts

So I read through the forums a bit and did not see a way to use check boxes instead of a drop down list when checking for domains from the home page for example (outside of whmcs).

 

So I put one together, and it seems to work rather well so far. I just gather the values of the checkboxes in javascript and build the bulkdomains field (used in the bulk check option) value adding the new line chars between each. Then send the form off the the domainchecker.php page.

 

So the onsubmit would return this function call:

 

If this was already posted somewhere, I apologize for not having found it.

 

(this code is poc only btw)

function makedq() {
var fdomain = document.getElementById("domain");
var fcom = document.getElementById("com");
var fnet = document.getElementById("net");
var forg = document.getElementById("org");
var fbulk = document.getElementById("bulkdomains");
var dq_arr = new Array();
var dq = "";
var tldcheck = 0;

if(fdomain.value.length > 2) {
	// build bulk
	if(fcom.checked) {
		dq_arr.push(fdomain.value + "." + fcom.value);
		++tldcheck;
	}
	if(fnet.checked) {
		dq_arr.push(fdomain.value + "." + fnet.value);
		++tldcheck;
	}
	if(forg.checked) {
		dq_arr.push(fdomain.value + "." + forg.value);
		++tldcheck;
	}
	// assemble bulk
	for(var r=0; r < dq_arr.length; ++r) {
		dq += dq_arr[r];
		if(dq_arr[r+1]) {
			// add new line
			dq += "%0D%0A";
		}
	}
	if(tldcheck > 0) {
		fbulk.value = unescape(dq);
		/* disable uneeded fields
		fdomain.disabled = true;
		fcom.disabled = true;
		fnet.disabled = true;
		forg.disabled = true;*/

		return true;
	} else {
		return false;
	}
} else {
	return false;
}
}

Link to comment
Share on other sites

Why don't you just use a simple form with regular checkboxes for the TLD selections?

 

Matt

 

Thats what I did, but in order to pass in a check for something like:

 

mydomain .com, .net and .org you have to send to the bulk check form. Otherwise you can only check one tld per query.

Link to comment
Share on other sites

  • 1 month later...

I just collect the checked values and pass them to the bulk checker. The form calls some JS that takes care of that. Nothing spectacular, and Im sure theres a cleaner way to do it, but:

 

function makedq() {
var fdomain = document.getElementById("domain");
var fcom = document.getElementById("com");
var fnet = document.getElementById("net");
var forg = document.getElementById("org");
var fbulk = document.getElementById("bulkdomains");
var dq_arr = new Array();
var dq = "";
var tldcheck = 0;

if(fdomain.value.length > 2) {
	// build bulk
	if(fcom.checked) {
		dq_arr.push(fdomain.value + "." + fcom.value);
		++tldcheck;
	}
	if(fnet.checked) {
		dq_arr.push(fdomain.value + "." + fnet.value);
		++tldcheck;
	}
	if(forg.checked) {
		dq_arr.push(fdomain.value + "." + forg.value);
		++tldcheck;
	}
	// assemble bulk
	for(var r=0; r < dq_arr.length; ++r) {
		dq += dq_arr[r];
		if(dq_arr[r+1]) {
			// add new line
			dq += "%0D%0A";
		}
	}
	if(tldcheck > 0) {
		fbulk.value = unescape(dq);
		/* disable uneeded fields */
		fdomain.disabled = true;
		fcom.disabled = true;
		fnet.disabled = true;
		forg.disabled = true;

		return true;
	} else {
		return false;
	}
} else {
	return false;
}
}

 

and the form is something like:

 

<form method="post" action="/clients/domainchecker.php" name="dnsform" id="dnsform" onsubmit="return makedq();">
<input name="domain" id="domain" value="" size="40" type="text" class="tldtext">
<div class="tldgrp"><input name="com" id="com" value="com" type="checkbox" class="tldcb" /><span class="tld">COM</span></div>
<div class="tldgrp"><input name="net" id="net" value="net" type="checkbox" class="tldcb" /><span class="tld">NET</span></div>
<div class="tldgrp"><input name="org" id="org" value="org" type="checkbox" class="tldcb" /><span class="tld">ORG</span></div>
<input type="hidden" name="bulkdomains" id="bulkdomains" value="" />
<input type="hidden" name="search" value="bulk">
</form>

 

I hope that helps you out or gets you headed in the direction you need.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated