Codice PHP:
<?
    
}

    
// Domain name error handling:

    
if(TYPE!="name" and strlen(DDOMAIN) < 3)
    {
        
disperror(ERROR_TOO_SHORT);
        if (
REPEAT_SEARCH_WINDOW) include_once(FILE_NAME);
        if (
WAIT_LAYER_ENABLED) echo '<script language="javascript">hidelayer("waitlayer");</script>';
        if (
DISPLAY_RESULT_FOOTER) include_once(FILE_NAME_FOOTER);
        exit;
    }
    if(
TYPE!="name" and strlen(DDOMAIN) > 63)
    {
        
disperror(ERROR_TOO_LONG);
        if (
REPEAT_SEARCH_WINDOW) include_once(FILE_NAME);
        if (
WAIT_LAYER_ENABLED) echo '<script language="javascript">hidelayer("waitlayer");</script>';
        if (
DISPLAY_RESULT_FOOTER) include_once(FILE_NAME_FOOTER);
        exit;
    }
    if(
TYPE!="name" and ereg("^-|-$",DDOMAIN))
    {
        
disperror(ERROR_HYPHEN);
        if (
REPEAT_SEARCH_WINDOW) include_once(FILE_NAME);
        if (
WAIT_LAYER_ENABLED) echo '<script language="javascript">hidelayer("waitlayer");</script>';
        if (
DISPLAY_RESULT_FOOTER) include_once(FILE_NAME_FOOTER);
        exit;
    }
    if(
TYPE!="name" and !ereg("([a-z]|[A-Z]|[0-9]|-){".strlen(DDOMAIN)."}",DDOMAIN))
    {
        
disperror(ERROR_CHARACTERS);
        if (
REPEAT_SEARCH_WINDOW) include_once(FILE_NAME);
        if (
WAIT_LAYER_ENABLED) echo '<script language="javascript">hidelayer("waitlayer");</script>';
        if (
DISPLAY_RESULT_FOOTER) include_once(FILE_NAME_FOOTER);
        exit;
    }
    if(
TYPE=="name")
    {
        if (!
eregi("\.",DDOMAIN))
        {
            
disperror(ERROR_NAME_DOT);
            if (
REPEAT_SEARCH_WINDOW) include_once(FILE_NAME);
            if (
WAIT_LAYER_ENABLED) echo '<script language="javascript">hidelayer("waitlayer");</script>';
            if (
DISPLAY_RESULT_FOOTER) include_once(FILE_NAME_FOOTER);
            exit;
        }
        else
        {
            list(
$leftpart$rightpart) = explode(".",DDOMAIN);
            if (
strlen($rightpart)<3)
            {
                
disperror(ERROR_NAME_LEN);
                if (
REPEAT_SEARCH_WINDOW) include_once(FILE_NAME);
                if (
WAIT_LAYER_ENABLED) echo '<script language="javascript">hidelayer("waitlayer");</script>';
                if (
DISPLAY_RESULT_FOOTER) include_once(FILE_NAME_FOOTER);
                exit;
            }
        }
    }

    if (
PROCESSING_TYPE=="2")
    {
        echo 
'<form action="'.LINK_EXTERNAL.'" method="POST">';
        echo 
'<input type="hidden" name="domain" value="'.DDOMAIN.'">';
    }

    echo 
'<table align="center" width="600" border="0" cellspacing="0" cellpadding="0">
        <tr><td width="100%" class="windowborder"><table width="600" border="0" cellspacing="1" cellpadding="2">
        <tr><td class="windowinside"><table width="100%" align="center" cellspacing="0" cellpadding="1">
        <tr>
            <td nowrap align="center" class="separator">[b]Domain[/b]</td>
            <td nowrap align="center" class="separator">[b]Status[/b]</td>
            <td nowrap align="center" class="separator">[b]Action[/b]</td>
        </tr>'
;

    
$avno=0
    if (
USE_ENGINE=="1") {
        if (
TYPE == 'all') {
            
$fp fopen(FILE_NAME_SERVERS,"r");
            while (!
feof ($fp)) {
                
$data fgets($fp4096);
                if (!
eregi('##',$data)) {
                    list(
$tld$include$server$nomatch$link) = explode("|",$data);
                    if (
$include=="1" and $tld!="name") {
                        
$ddomain eregi_replace(" ","",DDOMAIN);
                        
$domname $ddomain.".".$tld;
                        
$domname2 escapeshellcmd ($domname).".";
                        if (
checkdnsrr($domname2.".","NS")==false// check if there is a nameserver assigned to a domain
                        
{
                            if(
USE_EXTRACHECK)
                            {
                                
$extrano extracheck($domname,$server,$nomatch);
                                if (
$extrano=="1") {
                                    
dispav($domname,$link,$ddomain,$tld,0);
                                    
$avno=1;
                                } else {
                                    
dispun($domname,$server);
                                }
                            } else {
                                
dispav($domname,$link,$ddomain,$tld,0);
                                
$avno=1;
                            }
                        } else {
                            if(
USE_CNAMECHECK)
                            {
                                
// check if the domain is a canonical name
                                
if (checkdnsrr($domname2.".","CNAME")==true)
                                {
                                    
dispav($domname,$link,$ddomain,$tld,1);
                                    
$avno=1;
                                } else {
                                    
dispun($domname,$server);
                                }
                            } else {
                                
dispun($domname,$server);
                            }
                        }
                    }
                    else if (
$include=="1" and $tld=="name") {
                        echo 
"<tr><td colspan=3 align=center><font size=-2>".NAME_WARNING."</font></td></tr>";
                    }
                }
            }
            
fclose($fp);
        } else {
            
$fp fopen(FILE_NAME_SERVERS,"r");
            while (!
feof ($fp)) {
                
$data fgets($fp4096);
                if (!
eregi('##',$data)) {
                    list(
$tld$include$server$nomatch$link) = explode("|",$data);
                    if (
$tld==TYPE) {
                        
$ddomain eregi_replace(" ","",DDOMAIN);
                        
$domname $ddomain.".".$tld;
                        
$domname2 escapeshellcmd ($domname).".";
                        if (
checkdnsrr($domname2.".","NS")==false)
                        {
                            if (
USE_EXTRACHECK)
                            {
                                
$extrano extracheck($domname,$server,$nomatch);
                                if (
$extrano=="1") {
                                    
dispav($domname,$link,$ddomain,$tld,0);
                                    
$avno=1;
                                } else {
                                    
dispun($domname,$server);
                                }
                            } else {
                                
dispav($domname,$link,$ddomain,$tld,0);
                                
$avno=1;
                            }
                        } else {
                            if (
USE_CNAMECHECK)
                            {
                            
// check if the domain is a canonical name
                                
if (checkdnsrr($domname2.".","CNAME")==true)
                                {
                                    
dispav($domname,$link,$ddomain,$tld,1);
                                    
$avno=1;
                                } else {
                                    
dispun($domname,$server);
                                }
                            } else {
                                
dispun($domname,$server);
                            }
                        }
                    }
                }
            }
            
fclose($fp);
        }


    
// using nslookup command
    
    
} else if (USE_ENGINE=="2") {

        if (
TYPE == 'all') {
            
$fp fopen(FILE_NAME_SERVERS,"r");
            while (!
feof ($fp)) {
                
$data fgets($fp4096);
                if (!
eregi('##',$data)) {
                    list(
$tld$include$server$nomatch$link) = explode("|",$data);
                    if (
$include=="1" and $tld!="name") {
                        
$ddomain eregi_replace(" ","",DDOMAIN);
                        
$domname $ddomain.".".$tld$domname2 escapeshellcmd ($domname);
                        
$result ""$outputstring "";
                        
$command2 "nslookup -type=ns $domname2";
                        
exec ($command2,$result);
                        
$outputno count($result);
                        for (
$ino=0;$ino<=$outputno;$ino++) { $outputstring .= $result[$ino]; }
                        if (!
eregi("nameserver",$outputstring)) { 
                            if (
USE_EXTRACHECK)
                            {
                                
$extrano extracheck($domname,$server,$nomatch);
                                if (
$extrano==1) {
                                    
dispav($domname,$link,$ddomain,$tld,0);
                                    
$avno=1;
                                } else {
                                    
dispun($domname,$server);
                                }
                            } else {
                                
dispav($domname,$link,$ddomain,$tld,0);
                                
$avno=1;
                            }
                        } else { 
                            if (
USE_CNAMECHECK)
                            {
                                
// check if the domain is a canonical name
                                
$command3 "nslookup -type=cname $domname2";
                                
exec ($command3,$result3);
                                
$outputno3 count($result3);
                                for (
$ino3=0;$ino3<=$outputno3;$ino3++) { $outputstring3 .= $result3[$ino3]; }
                                if (!
eregi("canonical",$outputstring3)) { 
                                    
dispun($domname,$server);
                                } else {
                                    
dispav($domname,$link,$ddomain,$tld,1);
                                    
$avno=1;
                                }
                            } else {
                                
dispun($domname,$server);
                            }
                        }
                    } else if (
$include=="1" and $tld=="name") {
                        echo 
"<tr><td colspan=3 align=center><font size=-2>".NAME_WARNING."</font></td></tr>";
                    }
                }
            }
            
fclose($fp);
        } else {
            
$fp fopen(FILE_NAME_SERVERS,"r");
            while (!
feof ($fp)) {
                
$data fgets($fp4096);
                if (!
eregi('##',$data)) {
                    list(
$tld$include$server$nomatch$link) = explode("|",$data);
                    if (
$tld==TYPE) {
                        
$ddomain eregi_replace(" ","",DDOMAIN);
                        
$domname $ddomain.".".$tld$domname2 escapeshellcmd ($domname);
                        
$result ""$outputstring "";
                        
$command2 "nslookup -type=ns $domname2";
                        
exec ($command2,$result);
                        
$outputno count($result);
                        for (
$ino=0;$ino<=$outputno;$ino++) { $outputstring .= $result[$ino]; }
                        if (!
eregi("nameserver",$outputstring)) {
                            if (
USE_EXTRACHECK)
                            {
                                
$extrano extracheck($domname,$server,$nomatch);
                                if (
$extrano==1) {
                                    
dispav($domname,$link,$ddomain,$tld,0);
                                    
$avno=1;
                                } else {
                                    
dispun($domname,$server);
                                }
                            } else {
                                
dispav($domname,$link,$ddomain,$tld,0);
                                
$avno=1;
                            }
                        } else { 
                            if (
USE_CNAMECHECK)
                            {
                                
// check if the domain is a canonical name
                                
$command3 "nslookup -type=cname $domname2";
                                
exec ($command3,$result3);
                                
$outputno3 count($result3);
                                for (
$ino3=0;$ino3<=$outputno3;$ino3++) { $outputstring3 .= $result3[$ino3]; }
                                if (!
eregi("canonical",$outputstring3)) { 
                                    
dispun($domname,$server);
                                } else {
                                    
dispav($domname,$link,$ddomain,$tld,1);
                                    
$avno=1;
                                }
                            } else {
                                
dispun($domname,$server);
                            }
                        }
                    }
                }
            }
            
fclose($fp);
        }

    } else {


    
// using engine "3" - fsockopen() function - slowest but most reliable

        
if (TYPE == 'all') {
            
$fp fopen(FILE_NAME_SERVERS,"r");
            while (!
feof ($fp)) {
                
$data fgets($fp4096);
                if (!
eregi('##',$data)) {
                    list(
$tld$include$server$nomatch$link) = explode("|",$data);
                    if (
$include=="1" and $tld!="name") {
                        
$ddomain eregi_replace(" ","",DDOMAIN);
                        
$domname $ddomain.".".$tld;
                        
$result "";
                        
$ns fsockopen($server,43); fputs($ns,"$domname\r\n");
                        while(!
feof($ns)) $result .= fgets($ns,128); fclose($ns);
                        if (
eregi($nomatch,$result)) { $avno=1dispav($domname,$link,$ddomain,$tld,0); } else dispun($domname,$server);
                    } else if (
$include=="1" and $tld=="name") {
                        echo 
"<tr><td colspan=3 align=center><font size=-2>".NAME_WARNING."</font></td></tr>";
                    }
                }
            }
            
fclose($fp);
        }
        else
        {
            
$fp fopen(FILE_NAME_SERVERS,"r");
            while (!
feof ($fp)) {
                
$data fgets($fp4096);
                if (!
eregi('##',$data)) {
                    list(
$tld$include$server$nomatch$link) = explode("|",$data);
                    if (
$tld==TYPE) {
                        
$ddomain eregi_replace(" ","",DDOMAIN);
                        
$domname $ddomain.".".$tld;
                        
$result "";
                        
$ns fsockopen($server,43); fputs($ns,"$domname\r\n");
                        while(!
feof($ns)) $result .= fgets($ns,128); fclose($ns);
                        if (
eregi($nomatch,$result)) 
                        { 
$avno=1dispav($domname,$link,$ddomain,$tld,0); } else { dispun($domname,$server); }
                    }
                }
            }
            
fclose($fp);
        }
    }
    if (
PROCESSING_TYPE=="2" and $avno==1)
    {
        echo 
'<tr><td colspan="3" align="right"><input type=submit value="'.BUTTON_NEXT.'"></td></tr>';
    }

    echo 
'</table>';
    echo 
'</td></tr></table></td></tr></table>';

    if (
PROCESSING_TYPE=="2")
    {
        echo 
'</form>';
    }


    if (
WAIT_LAYER_ENABLED) { echo '<script language="javascript">hidelayer("waitlayer");</script>'; }

    
// if logging enabled write info to the file
    
if(WANTLOG)    {
        
$remote_addr $REMOTE_ADDR;
        
$today date("d-m-y H:i"time());
        if (
file_exists(FILE_NAME_LOG) and is_writeable(FILE_NAME_LOG))    {
            
$fp fopen(FILE_NAME_LOG,"a+");
            
$infolog "Date: $today | IP: $remote_addr | ".DDOMAIN."\n";
            
fputs($fp$infolog);
            
fclose($fp);
        }
    }
    if (
REPEAT_SEARCH_WINDOW)
    {
        include_once(
FILE_NAME);
    }
    if (
DISPLAY_RESULT_FOOTER) include_once(FILE_NAME_FOOTER);
    echo 
"&dom= $domname"//non toccare

    
echo "&dom2= $domname2"//non toccare

    
echo"&result= $result"//non toccare
    
echo"&mess= $what $whare";

    
?>