Codice PHP:
// using nslookup command
} else if (USE_ENGINE=="2") {
if (TYPE == 'all') {
$fp = fopen(FILE_NAME_SERVERS,"r");
while (!feof ($fp)) {
$data = fgets($fp, 4096);
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($fp, 4096);
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($fp, 4096);
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=1; dispav($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($fp, 4096);
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=1; dispav($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);
?>