• 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!

TOPIC: Whois lookup

Whois lookup 11 years 7 months ago #25064

I found a decent whoisscript, but my question is: Is it possible to implement it to a form, so users can see their available domain, and register it?

Here is the code (index.php):
<?php 
require_once("maxWhois.class.php"); 
$whois = new maxWhois();
?>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
   <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
   <title>Max's Whois</title>
   <link href="style/style.css" rel="stylesheet" type="text/css" />
</head>
 
<body>
 
<?php
    $whois->processWhois();
?>
 
</form> 
</body>

and the include file (maxWhois.class.php):
<?php
/*************************************************
 * Max's Whois
 *
 * Version: 1.0
 * Date: 2007-11-28
 *
 ****************************************************/
 
class maxWhois{
 
    var $serverList;
    var $tr = 0;
 
function maxWhois(){   
 
 
    $this->serverList[0]['top']      = 'nl';
	$this->serverList[0]['server']   = 'whois.domain-registry.nl';
	$this->serverList[0]['response'] = 'not a registered domain';
	$this->serverList[0]['check']    = true;
 
	$this->serverList[1]['top']      = 'be';
	$this->serverList[1]['server']   = 'whois.dns.be';
	$this->serverList[1]['response'] = 'No such domain';
	$this->serverList[1]['check']    = false;
 
	$this->serverList[2]['top']      = 'eu';
	$this->serverList[2]['server']   = 'whois.eu';
	$this->serverList[2]['response'] = 'AVAILABLE';
	$this->serverList[2]['check']    = false;
 
    $this->serverList[3]['top']      = 'com';
	$this->serverList[3]['server']   = 'whois.crsnic.net';
	$this->serverList[3]['response'] = 'No match for';
	$this->serverList[3]['check']    = false;
 
	$this->serverList[4]['top']      = 'net';
	$this->serverList[4]['server']   = 'whois.crsnic.net';
	$this->serverList[4]['response'] = 'No match for';
	$this->serverList[4]['check']    = false;
 
	$this->serverList[5]['top']      = 'org';
	$this->serverList[5]['server']   = 'whois.publicinterestregistry.net';
	$this->serverList[5]['response'] = 'NOT FOUND';
	$this->serverList[5]['check']    = false;
 
	$this->serverList[6]['top']      = 'biz';
	$this->serverList[6]['server']   = 'whois.nic.biz';
	$this->serverList[6]['response'] = 'Not found';
	$this->serverList[6]['check']    = false;
 
	$this->serverList[7]['top']      = 'info';
	$this->serverList[7]['server']   = 'whois.afilias.net';
	$this->serverList[7]['response'] = 'NOT FOUND';
	$this->serverList[7]['check']    = false;
 
 
}
 
function showHeader(){
?>
    <div id="container">
        <div id="header"><div id="header_left"></div>
        <div id="header_main">Controleer uw domeinnaam</div><div id="header_right"></div></div>
        <div id="content">
<?php
}
 
function showWhoisForm(){
?>
            <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" >
				<table class="dtable2">
                <tr><th colspan="5">Gewenste domein naam:</th></tr>
				<tr><td colspan="5"><center>www.<input name="domain" type="text" size="35" /></center></td></tr>
                <tr><th colspan="5">Selecteer het gewenste domein:</th></tr>
				<tr>
            <?php
            	$i = 0;
                foreach ($this->serverList as $value) {
                    if ($value['check'] == true) $checked=" checked ";
            		else $checked = " ";
 
            		echo '<td><input type="checkbox" name="top_'.$value['top'].'"'.$checked.'/>.'.$value['top'].'</td>';
                    $i++;            		
            		if ($i > 4) {
            		    $i = 0;
            		    echo '</tr><tr>';
            		}
            	}
 
            ?>				
				</tr>
				</table>
				<center><input type="submit" name="submitBtn" class="sbtn" value="Controleren" /></center>
            </form>
<?php
}
 
function showFooter(){
?>
        </div>
 
    </div>
 
<?php
}
 
function processWhois(){
    $this->showHeader();
 
    if (!isset($_POST['submitBtn'])){
        $this->showWhoisForm();
    } else {
 
        $domainName = (isset($_POST['domain'])) ? $_POST['domain'] : '';
 
       	for ($i = 0; $i < sizeof($this->serverList); $i++) {
       		$actTop = "top_".$this->serverList[$i]['top'];
       		$this->serverList[$i]['check'] = isset($_POST[$actTop]) ? true : false;
       	}
 
        // Check domains only if the base name is big enough
        if (strlen($domainName)>2){
            echo '<table class="dtable">';
            echo '<tr><th colspan="2">Resultaat</th></tr>';
 
           	for ($i = 0; $i < sizeof($this->serverList); $i++) {
	       		if ($this->serverList[$i]['check']){
			     	$this->showDomainResult($domainName.".".$this->serverList[$i]['top'],
			     	                        $this->serverList[$i]['server'],
			     	                        $this->serverList[$i]['response']);
			    }
		    }
 
		    echo '</table>';
        }
        $this->showWhoisForm();
 
    }
    $this->showFooter();
 
}
 
function showDomainResult($domain,$server,$findText){
   if ($this->tr == 0){
       $this->tr = 1;
       $class = " class='tr2'";
   } else {
       $this->tr = 0;
       $class = "";
   }
   if ($this->checkDomain($domain,$server,$findText)){
      echo "<tr $class><td>$domain</td><td class='ava'>BESCHIKBAAR</td></tr>";
   }
   else echo "<tr $class><td>$domain</td><td class='tak'>BEZET</td></tr>";
}
 
function checkDomain($domain,$server,$findText){
    $con = fsockopen($server, 43);
    if (!$con) return false;
 
    // Send the requested doman name
    fputs($con, $domain."\r\n");
 
    // Read and store the server response
    $response = ' :';
    while(!feof($con)) {
        $response .= fgets($con,128); 
    }
 
    // Close the connection
    fclose($con);
 
    // Check the response stream whether the domain is available
    if (strpos($response, $findText)){
        return true;
    }
    else {
        return false;   
    }
}
 
}
?>

The CSS file (style/style.css):
 
#container {
	margin: auto;
	width: 350px;
	border-top-width: 0px;
	border-right-width: 1px;
	border-bottom-width: 1px;
	border-left-width: 1px;
	border-top-style: solid;
	border-right-style: solid;
	border-bottom-style: solid;
	border-left-style: solid;
	border-top-color: #000033;
	border-right-color: #000033;
	border-bottom-color: #000033;
	border-left-color: #000033;
	background-color: #FFFFFF;
}
#container #header #header_left {
	float: left;
	background-image: url(images/header_left.gif);
	background-repeat: no-repeat;
	height: 42px;
	width: 45px;
}
#container #header #header_right {
	background-image: url(images/header_right.gif);
	background-repeat: no-repeat;
	height: 42px;
	width: 6px;
	float: right;
}
body {
	padding-top: 30px;
	background-color: #CCCCCC;
}
#container #content {
	padding: 5px;
	font-family: Geneva, Arial, Helvetica, sans-serif;
	font-size: 12px;
	font-weight: normal;
	color: #666666;
}
#container #footer {
	font-family: Geneva, Arial, Helvetica, sans-serif;
	font-size: 12px;
	color: #999999;
	text-align: right;
	border-top-width: 1px;
	border-right-width: 1px;
	border-bottom-width: 1px;
	border-left-width: 1px;
	border-top-style: solid;
	border-top-color: #999999;
	border-right-color: #000033;
	border-bottom-color: #000033;
	border-left-color: #000033;
	padding-top: 5px;
	padding-right: 10px;
	padding-bottom: 5px;
	padding-left: 5px;
}
#container #footer a {
	color: #999999;
	text-decoration: none;
	font-family: Geneva, Arial, Helvetica, sans-serif;
	font-size: 10px;
}
 
#container #header #header_main {
	float: left;
	padding: 5px;
	font-family: Geneva, Arial, Helvetica, sans-serif;
	font-size: 12px;
	font-weight: bold;
	color: #000033;
	margin-top: 5px;
	margin-right: 0px;
	margin-bottom: 0px;
	margin-left: 0px;
}
.sbtn {
	-moz-box-shadow:inset 0px 1px 0px 0px #f5978e;
	-webkit-box-shadow:inset 0px 1px 0px 0px #f5978e;
	box-shadow:inset 0px 1px 0px 0px #f5978e;
	background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #f24537), color-stop(1, #c62d1f) );
	background:-moz-linear-gradient( center top, #f24537 5%, #c62d1f 100% );
	filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#f24537', endColorstr='#c62d1f');
	background-color:#f24537;
	-webkit-border-top-left-radius:0px;
	-moz-border-radius-topleft:0px;
	border-top-left-radius:0px;
	-webkit-border-top-right-radius:0px;
	-moz-border-radius-topright:0px;
	border-top-right-radius:0px;
	-webkit-border-bottom-right-radius:0px;
	-moz-border-radius-bottomright:0px;
	border-bottom-right-radius:0px;
	-webkit-border-bottom-left-radius:0px;
	-moz-border-radius-bottomleft:0px;
	border-bottom-left-radius:0px;
	text-indent:0;
	border:1px solid #d02718;
	display:inline-block;
	color:#ffffff;
	font-family:Arial;
	font-size:15px;
	font-weight:bold;
	font-style:normal;
	height:40px;
	line-height:40px;
	width:100px;
	text-decoration:none;
	text-align:center;
	text-shadow:1px 1px 0px #810e05;
}
.sbtn:hover {
	background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #c62d1f), color-stop(1, #f24537) );
	background:-moz-linear-gradient( center top, #c62d1f 5%, #f24537 100% );
	filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#c62d1f', endColorstr='#f24537');
	background-color:#c62d1f;
}.sbtn:active {
	position:relative;
	top:1px;
}
.button {
	-moz-box-shadow:inset 0px 1px 0px 0px #f5978e;
	-webkit-box-shadow:inset 0px 1px 0px 0px #f5978e;
	box-shadow:inset 0px 1px 0px 0px #f5978e;
	background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #f24537), color-stop(1, #c62d1f) );
	background:-moz-linear-gradient( center top, #f24537 5%, #c62d1f 100% );
	filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#f24537', endColorstr='#c62d1f');
	background-color:#f24537;
	-webkit-border-top-left-radius:0px;
	-moz-border-radius-topleft:0px;
	border-top-left-radius:0px;
	-webkit-border-top-right-radius:0px;
	-moz-border-radius-topright:0px;
	border-top-right-radius:0px;
	-webkit-border-bottom-right-radius:0px;
	-moz-border-radius-bottomright:0px;
	border-bottom-right-radius:0px;
	-webkit-border-bottom-left-radius:0px;
	-moz-border-radius-bottomleft:0px;
	border-bottom-left-radius:0px;
	text-indent:0;
	border:1px solid #d02718;
	display:inline-block;
	color:#ffffff;
	font-family:Arial;
	font-size:15px;
	font-weight:bold;
	font-style:normal;
	height:40px;
	line-height:40px;
	width:100px;
	text-decoration:none;
	text-align:center;
	text-shadow:1px 1px 0px #810e05;
}
.button:hover {
	background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #c62d1f), color-stop(1, #f24537) );
	background:-moz-linear-gradient( center top, #c62d1f 5%, #f24537 100% );
	filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#c62d1f', endColorstr='#f24537');
	background-color:#c62d1f;
}.button:active {
	position:relative;
	top:1px;
}
 
#container #content #form1 legend {
	padding: 5px;
	margin: auto;
}
form {
	margin: auto;
	margin-top:20px;
	margin-bottom:20px;
}
 
#container #header {
	padding: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
	margin-left: 0px;
	background-image: url(images/header_bg.gif);
	background-repeat: repeat-x;
	height: 42px;
}
 
.dtable2{
	width:90%;
	margin:auto;
	border:1px solid #ccc;
	border-collapse:collapse;
}
 
.dtable{
	width:90%;
	margin:auto;
	border:1px solid #ccc;
	border-collapse:collapse;
}
 
.dtable th  {
    padding:5px;
	background-image: url(images/hbg.gif);
	background-repeat: repeat-x;
    color:#000033;
}
 
.dtable2 th  {
    padding:5px;
	background-image: url(images/hbg.gif);
	background-repeat: repeat-x;
    color:#000033;
}
 
.dtable td{
	padding:5px;
    border:1px solid #CCC;
}
 
.dtable2 td{
	padding:7px;
}
 
.ava {
    color:#009900;
    text-align:center;
}
 
.tak {
    color:#CC0000;
    text-align:center;
}
 
.tr2 {
    background-color:#F1F1F1
}
 
input {
    color: #555;
}
 
The administrator has disabled public write access.

Whois lookup 9 years 7 months ago #32570

is it really possible?
can we whois a domain inside rs form?
The administrator has disabled public write access.
  • 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!