#Until I rewrite my scripts, this will suffice for compatibility if(phpversion() >= "4.2.0"){ extract($_POST); extract($_GET); extract($_SERVER); extract($_ENV); } ?>
|
#Global kludge for new gethostbyaddr() behavior in PHP 4.1x
$ntarget = "";
#Some functions
function message($msg){
echo "$msg";
flush();
}
function dig($target){
global $ntarget;
message("DNS Query Results: "); #$target = gethostbyaddr($target); #if (! eregi("[a-zA-Z]", ($target = gethostbyaddr($target))) ) if( (!eregi("[a-zA-Z]", $target) && (!eregi("[a-zA-Z]", $ntarget)))) $msg .= "Can't do a DNS query without a hostname."; else{ if(!eregi("[a-zA-Z]", $target)) $target = $ntarget; if (! $msg .= trim(nl2br(`dig any '$target'`))) #bugfix $msg .= "The dig command is not working on your system."; } #TODO: Clean up output, remove ;;'s and DiG headers message($msg); } #If the form has been posted, process the query, otherwise there's #nothing to do yet if(!$queryType) exit; #Make sure the target appears valid if( (!$target) || (!preg_match("/^[\w\d\.\-]+\.[\w\d]{1,4}$/i",$target)) ){ #bugfix message("Error: You did not specify a valid target host or IP."); exit; } #Figure out which tasks to perform, and do them if( ($queryType=="all") || ($queryType=="dig") ) dig($target); ?> |