Array Issue help please

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi All
I have nearly got this working but it dose not seem to loop though or
return the result
 
I have done something wrong and I ask one of you coders that are much
cleverer that I to glance over my code to see the obvious mistake / s.
 
Thank you in advance for any help
 
Dave Carrera
 
// Start of my code
 
if(isset($_POST[domain])){
$uswhois = "whois.networksolutions.com";
$ukwhois = "whois.nic.uk";
$arr =
array(".co.uk",".org.uk",".plc.uk",".ltd.uk",".me.uk",".com",".net",".or
g");
echo "Top Level Domains: <br /><br />";
 $domname = $_POST[domain];
  while(list(,$tld)=each($arr)) {
   if(($tld == ".com") || ($tld == ".net") || ($tld == ".org")){
   $whois = $uswhois;
   $linenumber = 8;
   }
   else
   {
   $whois = $ukwhois;
   $linenumber = 2;
   }
   $stld = "$domname$tld to $whois using line $linenumber<br />";
   echo $stld;
   for($i=0;$i<=count($arr);$i++){
     $fp = fsockopen ("$whois", 43, $errno, $errstr, 30) or die("$errno:
$errstr");
        fputs($fp, "$domname$tld\n");
        while (!feof($fp)) {
                $serverReturn = fgets($fp, 2048);
                $x++;
                if ($x == $lineNumber) {
                        $line = $serverReturn;
                }
        }
        fclose($fp);
        $token = strtok("$line"," ");
        if ($token == 'No') {
                $result = 0;
        } else {
                $result = 1;
        }
        return $result;
        }
        $answer = $result;
   if(isset($answer)) {
     $checkeddom .= "<img src=\"./img/x.jpg\" border=\"0\">&nbsp;<font
color=red>$_POST[domain]$tld</font><br />";
   } else {
     $checkeddom .= "<img src=\"./img/tick.jpg\"
border=\"0\">&nbsp;<font color=green>$_POST[domain]$tld</b></font><br
/>";
   }
 }
 
}
//End of my code
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.443 / Virus Database: 248 - Release Date: 10/01/2003
 

[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux