
I am not a programmer and I got a php script I have to embed into a site I am working on. I have tried to create a UDT with the php code but couldn't get it working.
The script is supposed to check if a .dk domain name is free or not and post the result on the same page.
The php code:
Code: Select all
<?php
function verify_domain($domain) {
if (eregi("^[0-9a-z]+([0-9a-z-]+)*(\.dk)$", $domain)) {
return true;
} else {
return false;
}
}
if (isset($_POST["domain"])) {
$domain = strtolower($_POST["domain"]);
$taken = " er desværre <font color=ff0000>optaget</font>. - se registrantinfo her: <a href=http://www.dk-hostmaster.dk/index.php?id=42&query=" . $domain . "&submit.x=31&submit.y=12>" .$domain. "</a>" ;
$free = " er <font color=008000>ledigt</font>.";
$error = " <font color=ff0000>er ikke et gyldigt .dk-domæne.</font>";
if (verify_domain($domain)) {
if (checkdnsrr($domain, NS)) {
echo $domain . $taken;
} else {
echo $domain . $free;
}
} else {
echo $domain . $error;
}
}
?>
Code: Select all
<form action="index.php" method="post">
<input type="text" name="domain">
</form>
Thanks in advance!