| ~;
if (!$action) { print qq~ ~; }
if ($action eq 'search') { print "Query Results Thankyou for using our domain search. We have pleasure in presenting you with the results below. Search Again.
\n";
foreach $tld (@tlds) { if ($tld =~ /.uk/) { $whois_server = "whois.nic.uk"; } elsif ($tld =~ /uk./) { $whois_server = "whois.nomination.net"; } elsif ($tld =~ /info/) { $whois_server = "whois.afilias.net"; } elsif ($tld =~ /biz/) { $whois_server = "whois.nic.biz"; } else { $whois_server = "whois.crsnic.net"; }
$flag = ''; &whois; foreach $line (@out) { if ($line =~ /No match for/ || $line =~ /NOT FOUND/ || $line =~ /Not found/) { $flag++ } if ($line =~ /Whois Server/) { chomp $line; ($junk,$USwhois) = split(/\: /,$line); } }
if ($USwhois) { $dispWhois = "\L$USwhois"; $USwhois = ''; } else { $dispWhois = $whois_server; } if ($flag) { print "$dom.$tld may be AVAILABLE\n"; }
else { print qq~ $dom.$tld is not available View Whois \n~; } } print " \n"; } if ($action eq 'display') { $tld = $form{'ext'};
if (&whois) { print qq~ This is the raw whois output provided by $whois_server for the domain: $dom.$tld Search Again @out ~;
} else { print "ERROR - Whois server $whois_server not working!\n"; } } # End action display.
sub whois { $socket = IO::Socket::INET->new(Proto=>"tcp", PeerAddr=>"$whois_server",PeerPort=>'43',); if ($socket) { print $socket "$dom" . ".$tld" . "\015\012"; @out = <$socket>; close $socket; } }
sub parse { my($in, @in, $entry, $var, $val); $in = $ENV{'QUERY_STRING'}; @in = split(/\&/, $in); foreach $entry (@in) { $entry =~ s/\+/ /g; ($var, $val) = split(/=/, $entry, 2); $var =~ s/%([A-Fa-f0-9]{2})/pack("c",hex($1))/ge;
$val =~ s/%([A-Fa-f0-9]{2})/pack("c",hex($1))/ge; $form{$var} = $val; if ($var eq 'tld') { $tlds .=
"$val:"; } } @tlds = split(/\:/,$tlds); } print qq~ |