<h3>Domænetester.</h3>
<?php 
$tld = array("dk", "se", "com", "net", "org", "it", "nu", "info", "biz"); 
?> 

Indtast det domæne du vil tjekke.
<form action="<?=$_SERVER['PHP_SELF'];?>" method="get" style="margin: 0px; padding: 0px;"> 
<input type="text" name="name" value="<?php echo $_GET['name']; ?>" style="height: 16px; border: 1px Solid Black; font-family: Verdana; font-size: 12px; width: 200px;"> 
<select name="tld" style="border: 1px Solid Black; font-family: Verdana; font-size: 12px; width: 125px;"> 
<option value="all">Alle domæner</option> 
<?php 
for($i=0;$i<sizeof($tld);$i++) { 
if ($tld[$i] == $_GET["tld"]) { 
$tjekket = " SELECTED"; 
} else { 
$tjekket = ""; 
} 
echo " <option value=\"$tld[$i]\"$tjekket>$tld[$i]</option>"; 
} 
?>  
</select> 

<input type="submit" value="Søg" style="height: 20px; width: 60px; border-right: 1px Solid Black; border-bottom: 1px Solid Black; font-family: Verdana; font-size: 12px;"> 
</form> 
<?php 
error_reporting(0);

if (isset($_GET['name']) && strlen($_GET['name']) > 0) { 
if ($_GET['tld'] == "all") { 
$array = $tld; 
} else { 
$array = array($_GET['tld']); 
} 
echo "<table celpadding=\"0\" cellspacing=\"0\" border=\"0\">"; 
for ($i=0; $i<sizeof($array);$i++) { 
$_GET['tld'] = $array[$i]; 
$true = 0; 
$legal = 0; 

if ($_GET['tld'] == "nu") { 
$file = file("http://whois.nic.nu/".$_GET['name'].".".$_GET['tld']); 
while (@list($line_num, $line) = @each($file)) { 
eregi("NO MATCH for domain", $line) ? $true = 1: ""; 
} 
$legal = 1;
$info = "http://whois.nic.nu/".$_GET['name'].".".$_GET['tld'];
}
 
if ($_GET['tld'] == "dk") { 
$file = file("http://www.ripe.net/perl/whois?form_type=simple&full_query_string=&searchtext=".$_GET['name'].".".$_GET['tld']); 
while (@list($line_num, $line) = @each($file)) { 
eregi("ERROR:108: bad character in input", $line) ? $notlegal = 1 : ""; 
eregi("No entries found for the selected source", $line) ? $true = 1: ""; 
} 
if (!isset($notlegal)) {
$legal = 1;
$info = "http://www.ripe.net/perl/whois?form_type=simple&full_query_string=&searchtext=".$_GET['name'].".".$_GET['tld'];
}
} 

if ($_GET['tld'] == "se") { 
$file = file("http://www.iis.se/nydoman/domansok_result.shtml?domain=".$_GET['name'].".".$_GET['tld']); 
while (@list($line_num, $line) = @each($file)) {
eregi("No data found", $line) && substr_count($line, "(") == 0 ? $true = 1: "";
}
$legal = 1;
$info = "http://www.iis.se/nydoman/domansok_result.shtml?domain=".$_GET['name'].".".$_GET['tld'];
} 

if ($_GET['tld'] == "biz" || $_GET['tld'] == "com" || $_GET['tld'] == "org" || $_GET['tld'] == "net" || $_GET['tld'] == "info") { 
$file = file("http://www-whois.internic.net/cgi/whois?whois_nic=".$_GET['name'].".".$_GET['tld']."&type=domain"); 
while (@list($line_num, $line) = @each($file)) { 
eregi("Not found", $line) || eregi("No match for domain", $line) ? $true = 1: ""; 
} 
$legal = 1; 
$info = "http://www-whois.internic.net/cgi/whois?whois_nic=".$_GET['name'].".".$_GET['tld']."&type=domain";
} 

if ($_GET['tld'] == "it") { 
$file = file("http://www.ripe.net/perl/whois?form_type=simple&full_query_string=&searchtext=".$_GET['name'].".".$_GET['tld']); 
while (@list($line_num, $line) = @each($file)) { 
eregi("No entries found", $line) ? $true = 1: ""; 
} 
$legal = 1; 
$info = "http://www.ripe.net/perl/whois?form_type=simple&full_query_string=&searchtext=".$_GET['name'].".".$_GET['tld'];
} 

if ($legal == 1) { 
if ($true == 1) { 
print "<tr>\n<td width=\"10\" >\n<img src='green.gif'>\n</td>\n<td width=\"170\" >\n ".$_GET['name'].".".$_GET['tld']." er ledigt.\n</td>\n</tr>"; 
} else { 
print "<tr>\n<td width=\"10\" >\n<img src='red.gif'>\n</td>\n<td width=\"170\" >\n <a href='$info' target='_blank'>\n ".$_GET['name'].".".$_GET['tld']."\n</a>\n er optaget.\n</td>\n</tr>"; 
} 
} else { 
print "<tr>\n<td width=\"10\" >\n<img src='red.gif'>\n</td>\n<td width=\"170\" >\n<i> ".$_GET['name'].".".$_GET['tld']." kunne ikke testes.</i>\n</td>\n</tr>"; 
} 
} 

echo "</table>"; 
} 
 

?>