Jump to content

How to prevent using fake domains for purchasing a hosting plan


Craft

Recommended Posts

Why? I don't see the reason why you should check it.

If you really want to check it, be prepared because it's boring to do. On submit (when users click Use or press enter) you need to:

  1. preventDefault() the standard POST of WHMCS
  2. Run DomainWhois API function and read what the Registrar says
  3. Optionally run ping & nslookup
  4. If the domain exists, re-send the POST you have previously prevented otherwise load a modal to say "Dear visitor you can't use fake domains"
  5. Make sure that visitors can't bypass your verification process by simply turning off javascript (server-side validation in ClientAreaPage hook point)
Edited by Kian
Link to comment
Share on other sites

9 hours ago, Craft said:

How to prevent using fake domains for purchasing a hosting plan?

fake as in the domain literally doesn't exist, or in the sense that it's not my domain ?

9 hours ago, Craft said:

I need the system to check first if it's an existing domain or not, and if found it's a fake domain then don't accept it.

a quick way would be to use checkdnsrr, but it would not be 100% definitive (though I suspect no solution you could find would be 100% accurate)...

<?php

add_hook('ShoppingCartValidateDomain', 1, function($vars) {
	$domain = $vars['sld'].$vars['tld'];
	if($vars['domainoption'] == "owndomain" && !checkdnsrr($domain,"ANY")) {
		return 'The domain of '.$domain.' does not appear to be valid.';
	}
});

frHl6ln.png

so it's going to stop customers using "sgdfgdfgdfgdfg.com", but not "whmcs.com".

the hook could use language overrides in the return strings if the output needs to be in the users language, and can also be tweaked to be applicable to only certain products (and not all products as currently coded).

 

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