I am looking for a script that can see if the subdomain is available, for example here is some code that i thought might do it, but it does not appear to work does anyone have any ideas <form action="<?php echo $PHP_SELF; ?>" method="post"> <input name="sub" type="text">.bbi.cc<br> <input name="" type="submit"> </form> <? $hostname = "".$_POST['sub'].".bbi.cc"; $hosts = gethostbynamel($hostname); if (is_array($hosts)) { if (count($hosts) == 1){ echo "Sub Domain Taken"; } elseif (count($hosts) > 1){ echo "Sub Domain Available"; } } ?> Code (markup):
here you have two possible situations: 1. no wildcard dns entry, every subdomain have an own DNS entry. Here you can use checkdnsrr() to check for a free subdomain. 2. wildcard dns entry, then a subdomain can have an own entry, or its managed over die wildcard DNS entry. If the wildcard is used, you have to grap and analyse the subdomains. need you a script only for one special domain or to check subdomain from many different domains?
If using wildcard DNS why not just track when a subdomain is created and destroyed in a database. As long as you keep track correctly of this there shouldn't be any issues.