\n"; } else { echo "Connection Succesfull!\n"; return $connection; } } // print the error if ther eis no connection if (!$irc) { echo "No connection\n"; echo $errstr." (".$errno.")
\n"; } else { // write data through the socket to join the channel fwrite($irc, "NICK ".$nick."\r\n"); fwrite($irc, "USER ".$ident." ".$host." bla :".$realname."\r\n"); fwrite($irc, "PRIVMSG nickserv :identify ******\r\n"); while (!feof($irc)) { // Continue the rest of the script here while($data = fgets($irc, 128)) { echo $data."\n"; flush(); // Separate all data $ex = explode(' ', $data); // Send PONG back to the server if($ex[0] == "PING"){ fputs($irc, "PONG ".$ex[1]."\n"); } // DO something on the IRC server $command = str_replace(array(chr(10), chr(13),chr(58)), '', $ex[3]); if ($command == $cmdprefix."sterf") { fputs($irc, "QUIT Goodbye! \n"); } elseif($command == $cmdprefix."join") { fputs($irc, "JOIN ".$ex[4]); } } } } ?>