Jump to content

How do I dissallow sme domain searches?


Recommended Posts

I had someone give me a call, because our system was allowing them to search for funny domain names lilke:

 

-one.com

-two.com

 

Notice the - at the front of the domain.

 

Any way round this?

 

I can also confirm this.

 

Try the WHMCS demo, below, it’s allowing dash e.g –one , as a domain name.

 

http://demo.whmcs.com/cart.php?a=add&pid=2

Link to comment
Share on other sites

Can this please be sorted or a workaround made - might be a good idea to have it build into the next release please.

after i have seen i was wrong yesterday , i wrote one , tell me if you find anything wrong with it . if everything is ok , i will give it to you till whmcs do something about it.

 

http://www.hosting777.com/clients/domainchecker.php

 

and dont worry about the message there , it will popup when there are illegal characters in the domain as well

Link to comment
Share on other sites

When I first read this, I wondered whether -one.com was a valid domain name. It isn't, so we're correct in discussing this. Just thought I'd post in case anyone else was wondering the same thing ...

 

"The only valid characters for a domain name are letters, numbers and a hyphen "-". Hyphens may be anywhere in the middle of a name, but can not be located at the end or beginning of a name. A valid domain name does not have spaces. A domain name can be up to 67 characters long -- including the 4 characters used to identify the Top Level Domain (.com, net, .org). Do not type the www. or your ext. before your domain name when registering as it is automatically inserted."

 

Also the RFC says a domain name has to start with a letter, but I'm pretty sure modern domains can start with a number (they definitely can in the .au namespace).

Link to comment
Share on other sites

Also the RFC says a domain name has to start with a letter, but I'm pretty sure modern domains can start with a number (they definitely can in the .au namespace).

 

That RFC revision is wrong. It *used* to be that domains had to *contain* a letter, but IISTR even thats been dropped for most TLDs now.

Link to comment
Share on other sites

according to what you say , i think the following code will make all the validations needed (domainchecker.tpl) any corrections or modifications to the code are welcome .

 

{literal}
<script type="text/javascript">
function validate(){
validField = /^[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9]$/;
domainStr = document.forms.checkdomain.domain.value;
if (validField.test(domainStr) == false)
 {
     alert("INVALID DOMAIN \nDomain Name must start and end with a letter or a number \nDomain should not Include illegal characters or empty spaces");
     return false;
  }
  }
  </script>
{/literal}

 

and your form action should look like this :

<form name=checkdomain method="post" action="domainchecker.php" onSubmit="return validate()">

Link to comment
Share on other sites

  • 1 month later...

All I did was to just add some verbiage to the pop-up statement in the above code. Thanks joe123 for the code.

{literal}
<script type="text/javascript">
function validate(){
validField = /^[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9]$/;
domainStr = document.forms.checkdomain.domain.value;
if (validField.test(domainStr) == false)
 {
     alert("INVALID DOMAIN \nDomain Name must start and end with a letter or a number. \nDomain should not Include illegal characters or empty spaces Your search on The Domain produced the following error:\n\nThe Rules: \n* Unless the Top Level Domain you are using requires or supports a Second Level Domain for classification (the \"co\" in .co.uk), you should not enter anything but a domain name and a Top Level Domain. \n* Don't put \"www.\" in front of the domain. \"www.\" is a host name, not a domain name. You should not use \"www\" anywhere unless it part of the actual domain name you are looking for. \n* Legal characters are 0-9, a-z and the dash sign ( - ) or the Underscores ( _ )  ?.? Spaces are not permitted in domains. \n\nA list of errors and their meanings follows: \n\n* Domain name too long/short This means that the domain name that you entered was either too long or too short, legal sdomain name lengths are between 2 characters and 57 characters. \n\n* Domain name cannot contain any letters of hyphens in 2 character domain names This error message is returned if your domain name was only 2 characters long and it contained either a hyphen or a letter, this is because 2 character domain names are only allowed to contain numbers. \n\n* Domain names cannot begin or end in a hyphen or contain double hyphens A domain name can contain hyphens, however the hyphens cannot be neighbours (ie \"--\") and they also cannot begin the domain name or end it, ie \"-abchois.xxx\" is illegal as it begins with a hyphen. \n\n* Domain names must only contain alphanumerical characters and hyphens Domain names must only consist of numbers, letter and hyphens - this means that no spaces, periods, commas or any other kind of punctuation is allowed. This is common when people begin the domain name with \"www.\" - this is not part of the domain name and should not be used. \n\n* Cannot connect to [server name] If you recieve this message then the whois server that I am trying to connect to in order to perform your query is either refusing my network connection or for some other reason I am unable to connect to it, the best course of action when this occurs is to simply try again later. \n\n* No top level domain selected This means that you failed to select a top level domain for your domain name, for example `co.uk', `com', `net' etc. \n\n* Top level domain not supported This error message means that whichever top level domain extension you chose is not supported by this scripts configuration, in other words, I do not have the information required to search for this top level domain.");
     return false;
  }
  }
  </script>
{/literal}

<form name=checkdomain method="post" action="domainchecker.php" onSubmit="return validate()">

Link to comment
Share on other sites

  • 9 months later...

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