domain validation
Posted: Thu May 27, 2004 10:38 am
Hi Everyone,
I am creating an order form for a hosting company.
The actual form for the domain registration page has 1 text box, 1 drop down list and 2 radio buttons.
Visitors are supposed to type there domain in the text box just like this:
"mydomain"
Then they are supposed to select their extension from the drop down list. Ex... .com, .net ect...
Then they are supposed to select 1 of 2 radio buttons. "Either the domain is registered or it isn't."
If they select that it's NOT registered, then my script checks to see if the domain is available. If they select that it's already registered, they move on to the next section of the order form.
Here's the problem. Some people can not follow simple directions, so in the box they type mydomain.com.
That is fine, my script removes any http://, https://, ftp://, http://www., and removes any valid extension they add to it. (ie.. .com, .net, .info ect..).
My script is not yet smart enough to remove subdomains though. If someone were to type in the box:
http://forums.mydomain.com/ my script would see: forums.mydomain.com
My script would come back and say that the domain is available, and I can not register sub-domains.
Here is my current code which removes all the bad stuff (Except Sub-Domains)
$domain = str_replace("www.", "", $domain);
$domain = str_replace("http://", "", $domain);
$domain = str_replace(".com", "", $domain);
$domain = str_replace(".net", "", $domain);
$domain = str_replace(".org", "", $domain);
$domain = str_replace(".info", "", $domain);
$domain = str_replace(".biz", "", $domain);
$domain = str_replace(".edu", "", $domain);
$domain = str_replace(".cc", "", $domain);
$domain = str_replace(".ca", "", $domain);
$domain = str_replace(".org.uk", "", $domain);
$domain = str_replace(".co.uk", "", $domain);
$domain = str_replace(".ws.uk", "", $domain);
$domain = str_replace(".us.uk", "", $domain);
$domain = str_replace("/", "", $domain);
Now after all this is done, I need something to check the domain and see if it is in a sub-domain format. If it is a subdomain, then the script needs to remove only the subdomain and the period. subdomain.mydomain.com
Any sample code would be great.
Thanks,
Vince
I am creating an order form for a hosting company.
The actual form for the domain registration page has 1 text box, 1 drop down list and 2 radio buttons.
Visitors are supposed to type there domain in the text box just like this:
"mydomain"
Then they are supposed to select their extension from the drop down list. Ex... .com, .net ect...
Then they are supposed to select 1 of 2 radio buttons. "Either the domain is registered or it isn't."
If they select that it's NOT registered, then my script checks to see if the domain is available. If they select that it's already registered, they move on to the next section of the order form.
Here's the problem. Some people can not follow simple directions, so in the box they type mydomain.com.
That is fine, my script removes any http://, https://, ftp://, http://www., and removes any valid extension they add to it. (ie.. .com, .net, .info ect..).
My script is not yet smart enough to remove subdomains though. If someone were to type in the box:
http://forums.mydomain.com/ my script would see: forums.mydomain.com
My script would come back and say that the domain is available, and I can not register sub-domains.
Here is my current code which removes all the bad stuff (Except Sub-Domains)
$domain = str_replace("www.", "", $domain);
$domain = str_replace("http://", "", $domain);
$domain = str_replace(".com", "", $domain);
$domain = str_replace(".net", "", $domain);
$domain = str_replace(".org", "", $domain);
$domain = str_replace(".info", "", $domain);
$domain = str_replace(".biz", "", $domain);
$domain = str_replace(".edu", "", $domain);
$domain = str_replace(".cc", "", $domain);
$domain = str_replace(".ca", "", $domain);
$domain = str_replace(".org.uk", "", $domain);
$domain = str_replace(".co.uk", "", $domain);
$domain = str_replace(".ws.uk", "", $domain);
$domain = str_replace(".us.uk", "", $domain);
$domain = str_replace("/", "", $domain);
Now after all this is done, I need something to check the domain and see if it is in a sub-domain format. If it is a subdomain, then the script needs to remove only the subdomain and the period. subdomain.mydomain.com
Any sample code would be great.
Thanks,
Vince