Internal Server Error

 
Post new topic   Reply to topic    Aprelium Forum Index -> PHP
View previous topic :: View next topic  
Author Message
Mikor
-


Joined: 21 Aug 2006
Posts: 144
Location: Hull, England

PostPosted: Wed Oct 11, 2006 6:50 pm    Post subject: Internal Server Error Reply with quote

Something in this code causes an internal server error, I cant find it...

Code:
function whois ($server, $query, $port, $avaliable_phrases){
   $query = whois_prepare($query, $server);
   $avaliable = false;
   $sock = @fsockopen($server,$port);
   
   if(!$sock){
      $output = '<tr><td>'.$query.'</td><td style=\'color:#FF0000\' colspan=\'2\'>Could not open socket.</td></tr>';
         return $output;
   }else{
      $send_request = @fputs($sock,$query.'\r\n');

      if(!$send_request){
         $output = '<tr><td>'.$query.'</td><td style=\'color:#FF0000\' colspan=\'2\'>Unable to send request.</td></tr>';
         return $output;
      }else{
         while(!feof($sock)) {
            $whois = @fgets($sock,128);
         }

         foreach($avaliable_phrases as $phrase){
            if(eregi($phrase,$whois)){
               $avaliable = true;
            }
         }
      
         @fclose($sock);
         
         if($avaliable == true){
            $output = '<tr><td>'.$query.'</td><td style=\'color:#00FF00\'>Avaliable</td><td style=\'text-align:center;\'>n/a</td></tr>';
         }else{
            $output = '<tr><td>'.$query.'</td><td style=\'color:#FF0000\'>Unavaliable</td><td><a href=\'domainwhois.php?domain='.$query.'\'>Whois</a></td></tr>';
         }
         
         return $output;
      }
   }
}

_________________
Yarrt.com - Free Arcade
RypNet.co.uk - Online Game

MSN:
michael_walker_2004 <at> hotmail <dot> com
Back to top View user's profile Send private message Send e-mail MSN Messenger
Mikor
-


Joined: 21 Aug 2006
Posts: 144
Location: Hull, England

PostPosted: Wed Oct 11, 2006 7:34 pm    Post subject: Reply with quote

well, i've found out that its caused by the fgets - any ideas?
_________________
Yarrt.com - Free Arcade
RypNet.co.uk - Online Game

MSN:
michael_walker_2004 <at> hotmail <dot> com
Back to top View user's profile Send private message Send e-mail MSN Messenger
Mikor
-


Joined: 21 Aug 2006
Posts: 144
Location: Hull, England

PostPosted: Wed Oct 11, 2006 8:49 pm    Post subject: Reply with quote

Fixed, it appears that I had an outdated list of whois servers...
_________________
Yarrt.com - Free Arcade
RypNet.co.uk - Online Game

MSN:
michael_walker_2004 <at> hotmail <dot> com
Back to top View user's profile Send private message Send e-mail MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Aprelium Forum Index -> PHP All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB phpBB Group