//If Query is set, fix it up
if(isset($_REQUEST['Query']) && $_REQUEST['Query']!='')
{
$NewQuery=(preg_match('/[^.]+\.[^.]+$/', $_REQUEST['Query'], $Ret) ? $Ret[0] : ''); //Remove subdomains - Update to only contains 1 dot
$NewQuery=preg_replace('/[^-a-z.0-9]/', '', strtolower($NewQuery)); //Update to lower case and so it only contains proper characters
if($NewQuery=='') //If fixed domain name is empty...
print 'Domain name is invalid.';
else //Otherwise, run whois
{
exec("/usr/bin/whois -i \"$NewQuery\"", $OutputArray); //Run the query
print "
WHOIS Output for $NewQuery:
"; //Output the fixed domain name
foreach($OutputArray as $Line) //Return the whois output
print htmlentities($Line, ENT_QUOTES, 'UTF-8').'
';
}
}
?>