Jump to content

Whois


eaglelegend

Recommended Posts

Hey!,

 

On my site I have this little whois feature, to search to see if there are any tlds available of which my user might be after, however for some odd reason, from .co.uk to the last tld available, it automatically lists them as if they have been selected, thing is, they havent...

 

Any ideas? Help much appreciated, thanks in advance!

 

<?php

    function checkDomain($domain,$server,$findText){

        // Open a socket connection to the whois server

        $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;   

        }

    }

    

    function showDomainResult($domain,$server,$findText){

       if (checkDomain($domain,$server,$findText)){

          echo "<tr><td>$domain</td><td>AVAILABLE</td></tr>";

       }

       else echo "<tr><td>$domain</td><td>TAKEN</td></tr>";

    }

?>

<style type="text/css"><!--

   .header {font-family:Tahoma, sans-serif; font-size: 12px; COLOR:#2FFFFF; padding-left:10; padding-right:5; font-weight:900 }

   .text {font-family:Tahoma,sans-serif; font-size: 11px; color:#626567; padding-left:20; padding-right:10 }

   .text2 {font-family:Verdana,sans-serif; font-size: 10px; color:#808087; padding-left:20; padding-right:10 }

    .news {font-family:Arial, sans-serif; font-size: 9px; color:#808087; padding-left:10; padding-right:5; font-weight:900; }

   a:link{text-decoration: none; color:#6699CC}

  a:visited{text-decoration: none; color: #6699CC}

  a:hover{text-decoration: underline; color: #6699CC}

  a:active{text-decoration: none; color: #6699CC}

li {

   list-style-image:url('images/pic.jpg')

}



--></style>

                                 <tr>

                                    <td align="center">

                                    <div align="center">

                                       <table style="border-collapse: collapse;" id="table6" border="1" bordercolor="#c2e7ec" cellpadding="2" height="162" width="555">

                                          <tbody><tr>

                                             <td valign="top" height="158">

                                             <div align="center">

                                                <table id="table7" border="0" cellpadding="2" cellspacing="0" width="100%">

                                                   <tbody><tr>

                                                      <td>

                                                      <div align="center">

                                                         <table id="table52" border="0" cellspacing="0" width="98%">

                                                            <tbody><tr>

                                                               <td>

                                                               <div align="center">

                                                                  <table id="table3" border="0" cellpadding="2" cellspacing="0" width="100%">

               <tbody><tr>

                  <td>

                   </td>

               </tr>

               <tr>

                  <td>

                  <table id="table4" border="0" cellpadding="0" cellspacing="0" width="528">

                     <tbody><tr>

                        <td width="525">

                  <p align="justify"><font face="Arial">

                  <font color="#666666" style="font-size: 9pt; font-weight: 700">

                  Domain Names</font></font></p>

                  <p align="justify">Sorry!, we do not currently offer domains. Why don't you try out our new domain lookup tool below to see if the domain name of your dreams is available! Please note we currently support limited TLDs (Top Level Domains - .com, .co.uk etc.) on the lookup, we will be adding more options soon!</p>
<p>    <div id="main">

      <div id="caption"><b>Domain Lookup</b></div>

      <div id="icon"> </div>

      <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" name="domain" id="domain">

        Domain name:

        <table>

          <tr><td><input class="text" name="domainname" type="text" size="36"/></td></tr>

          <tr>

            <td>

                <input type="checkbox" name="all" checked />All

                <input type="checkbox" name="com"/>.com

                <input type="checkbox" name="net"/>.net

                <input type="checkbox" name="org"/>.org
      <input type="checkbox" name="co.uk"/>.co.uk
      <input type="checkbox" name="org.uk"/>.org.uk
      <input type="checkbox" name="ltd.uk"/>.ltd.uk
      <input type="checkbox" name="plc.uk"/>.plc.uk
      <input type="checkbox" name="me.uk"/>.me.uk

                <input type="checkbox" name="info"/>.info
      <input type="checkbox" name="edu"/>.edu

            </td></tr>

            <tr><td align="center"><br/><input class="text" type="submit" name="submitBtn" value="Check domain"/></td></tr>

        </table> 

      </form>

<?php    

    if (isset($_POST['submitBtn'])){

        $domainbase = (isset($_POST['domainname'])) ? $_POST['domainname'] : '';

        $d_all      = (isset($_POST['all'])) ? 'all' : '';    

        $d_com      = (isset($_POST['com'])) ? 'com' : '';    

        $d_net      = (isset($_POST['net'])) ? 'net' : '';    

        $d_org      = (isset($_POST['org'])) ? 'org' : '';
   $d_couk    = (isset($_POST['couk'])) ? 'co.uk' : '';   
   $d_orguk    = (isset($_POST['orguk'])) ? 'org.uk' : '';
   $d_ltduk    = (isset($_POST['ltduk'])) ? 'ltd.uk' : '';
   $d_plcuk    = (isset($_POST['plcuk'])) ? 'plc.uk' : '';
   $d_meuk    = (isset($_POST['meuk'])) ? 'me.uk' : ''; 

        $d_info     = (isset($_POST['info'])) ? 'info' : '';
        $d_edu      = (isset($_POST['edu'])) ? 'edu' : ''; 

        

        // Check domains only if the base name is big enough

        if (strlen($domainbase)>2){

?>

      <div id="caption">RESULT</div>

      <div id="icon2"> </div>

      <div id="result">

        <table width="100%">

<?php        

            if (($d_com != '') || ($d_all != '') ) showDomainResult($domainbase.".com",'whois.crsnic.net','No match for');

            if (($d_net != '') || ($d_all != '') ) showDomainResult($domainbase.".net",'whois.crsnic.net','No match for');

            if (($d_org != '') || ($d_all != '') ) showDomainResult($domainbase.".org",'whois.publicinterestregistry.net','NOT FOUND');
       if (($d_co.uk != '') || ($d_all != '') ) showDomainResult($domainbase.".co.uk",'whois.nic.uk','No match'); 
       if (($d_org.uk != '') || ($d_all != '') ) showDomainResult($domainbase.".org.uk",'whois.nic.uk','No match'); 
       if (($d_ltd.uk != '') || ($d_all != '') ) showDomainResult($domainbase.".ltd.uk",'whois.nic.uk','No match'); 
       if (($d_plc.uk != '') || ($d_all != '') ) showDomainResult($domainbase.".plc.uk",'whois.nic.uk','No match'); 
       if (($d_me.uk != '') || ($d_all != '') ) showDomainResult($domainbase.".me.uk",'whois.nic.uk','No match'); 

            if (($d_info != '') || ($d_all != '') ) showDomainResult($domainbase.".info",'whois.afilias.net','NOT FOUND');
            if (($d_edu != '') || ($d_all != '') ) showDomainResult($domainbase.".edu",'whois.internic.net','No match for');

?>

        </table>

     </div>

<?php            

        }

    }

?>   

    </div></p>

                  <center>

<!--Advertise Here-->

</td>

                        <td width="3">

                        <p align="right"></p></td>

                     </tr>

                  </tbody></table>

                  </td>

               </tr>

            </tbody></table></div>

                                                               </td>

                                                            </tr>

                                                            </tbody></table>

                                                      </div>

                                                      </td>

                                                   </tr>

                                                   <tr>

                                                      <td>

                                                      <p style="text-align: center;" align="center">

                                                      <img src="images/logobot.jpg" border="0" height="70" width="535"></p></td>

                                                   </tr>

                                                   </tbody></table>

                                             </div>

                                             </td>

                                          </tr>

                                       </tbody></table>

                                    </div>

                                    </td>

                                 </tr>

Link to comment
Share on other sites

For starters, these variables....

 

$_POST['couk']

$_POST['orguk']

$_POST['ltduk']

$_POST['plcuk']

$_POST['meuk']

 

Do not exist in your form.

 

To be honest, theres a whole bunch of redundant code in your script.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.