vafen

dc1

Aug 7th, 2011
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.39 KB | None | 0 0
  1. <?php
  2. function checkDomain($domain,$server,$findText){
  3. // Open a socket connection to the whois server
  4. $con = fsockopen($server, 43);
  5. if (!$con) return false;
  6.  
  7. // Send the requested domain name
  8. fputs($con, $domain."\r\n");
  9.  
  10. // Read and store the server response
  11. $response = ' :';
  12.  while(!feof($con)) {
  13. $response .= fgets($con,128);
  14.  }
  15.  
  16.  //Close the connection
  17.  fclose($con);
  18.  
  19. // Check the response stream whether the domain is available
  20.  if (strpos($response, $findText)){
  21. return true;
  22.  }
  23.  else {
  24.  return false;  
  25.  }
  26. }
  27. function showDomainResult($domain,$server,$findText){
  28. if (checkDomain($domain,$server,$findText)){
  29.  echo "<tr><td>$domain</td><td>AVAILABLE</td></tr>";
  30.  echo "<input type='radio' name='radiobtn' value='$domain' checked/>".$domain;
  31.  
  32.  }
  33. else echo "<tr><td>$domain</td><td>TAKEN</td></tr>";  
  34.  }
  35.  
  36.      if ($beirhat == 'NYOMJAD')
  37.      {
  38.  
  39.         $domainbase = (isset($_POST['domainname'])) ? $_POST['domainname'] : '';
  40.         $d_hu = (isset($_POST['hu'])) ? 'hu' : '';
  41.         $d_eu = (isset($_POST['eu'])) ? 'eu' : '';
  42.         // Check domains only if the base name is big enough
  43.         if (strlen($domainbase)>2){
  44.         echo '<table width="100%">';
  45.         if ($d_hu != '')  
  46.         showDomainResult($domainbase.".hu",'whois.nic.hu', 'No match');
  47.         echo '</table>';
  48.         }
  49.         if (strlen($domainbase)>2){
  50.         echo '<table width="100%">';
  51.         if ($d_eu != '')  
  52.         showDomainResult($domainbase.".eu",'whois.eu','AVAILABLE');
  53.         echo("</table>");
  54.         };
  55.         echo ("<form method='post' action=$PHP_SELF name='domain'>
  56.         <table width='60%' border='0'>
  57.           <tr>
  58.             <td><div align='center'><input type='submit' name='beirhat' value='ROGZITES'></div></td>
  59.           </tr>
  60.         </table>
  61.         </form>");
  62.  
  63.      }
  64.     elseif ($beirhat=='ROGZITES')
  65.     {$atad='ide kő vmi';
  66.                         echo("
  67.                         <SCRIPT LANGUAGE='JavaScript'>
  68.                         location.href='megnyit.php?atad=$atad'
  69.                         </SCRIPT>
  70.                     ");        
  71.     }
  72.     else
  73.     {
  74.  
  75.  
  76.  
  77.  echo("<form method='post' action=$PHP_SELF name='domain'>
  78. <table>
  79. <tr>
  80.  <td>&nbsp;</td>
  81.  <td><input name='domainname' type='text' /></td>
  82. </tr>
  83. <tr>
  84.  <td><input type='checkbox' name='hu' checked/>.hu</td>
  85. </tr>
  86. <tr>
  87.  <td><input type='checkbox' name='eu' checked/>.eu</td>
  88. </tr>
  89. </table>
  90.  
  91. <table width='60%' border='0'>
  92.  <tr>
  93.     <td><div align='center'><input type='submit' name='beirhat' value='NYOMJAD'></div></td>
  94.  </tr>
  95. </table>
  96. </form>");
  97.     }
  98. ?>
Advertisement
Add Comment
Please, Sign In to add comment