954,576 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Domain Check problem

First of all, hello folks.

Now, I have a problem with a PHP script for checking domain availability.

No mather what domain name I type on web page in a form, script always says "already in use". If anyone could help me,? tnx

Here is the code:

<?php
//error_reporting(0);

function lookup($domain)
{
    exec("host -t ns $domain",$hasil);
    if (ereg("host not found.",strtolower(trim($hasil[0]))))
    // It possible only 1 ns or not found
    {
        return false;
    } else
    {
        $hasilstr="";
        for ($i=0;$i<=count($hasil);$i++)
        {
        $hasilstr.=ereg_replace("$domain name server","<LI>",$hasil[$i])."<BR>";
        }
        return $hasilstr;
    }
} 
?>



<?
$domain=$_POST['domain'];
if (!lookup("$domain"))
{
    echo "$domain is available";
} else
{
    echo "$domain already in use";
} 
?>
Celtwarrior
Newbie Poster
1 post since Aug 2009
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You