connections . "\r\n"; $this->bots[$this->connections] = array( $localhost, $remotehost, $port, $nick, $user, $real ); echo "This bot is " . $this->bots[$this->connections][4] . "\r\n"; $this->connections += 1; return 1; } function connect() { for ($x = 0; $x < $this->connections; $x++) { $this->bot[$x] = new connection; $this->bot[$x]->newc(0, $this->bots[$x][0], $this->bots[$x][1], $this->bots[$x][2], $this->bots[$x][3], $this->bots[$x][4], $this->bots[$x][5]); $this->bot[$x]->readdata(); } while (1) { for ($x = 0; $x < $this->connections; $x++) { $this->bot[$x]->readdata(); } } } } class connection { public $socket; function newc($id, $localhost, $remotehost, $port, $nick, $user, $real) { $this->socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); socket_bind($this->socket, $localhost); socket_connect($this->socket, $remotehost, $port); socket_set_nonblock($this->socket); socket_write($this->socket, "USER " . $real . " " . $localhost . " " . $real . " " . $real . "\r\n"); socket_write($this->socket, "NICK " . $nick . "\r\n"); socket_write($this->socket, "JOIN #annihilation,#rena\r\n"); $this->readdata; } function readdata() { if ($rdata = trim(socket_read($this->socket, 128))) { echo $rdata . "\r\n"; flush(); $ex = explode(" ", $rdata, 4); if($ex[0] == "PING"){ socket_write($socket, "PONG " . $ex[1] . "\r\n"); } if ($rdata = ":Rena!h@s.six.ears PRIVMSG #Annihilation :ping") { socket_write($this->socket, "PRIVMSG #annihilation :pong"); } } } } $IRC = new main; $IRC->addbot('loli.catl.in', 'irc.swiftirc.net', 6667, '[1]Catlin', 'Catlin', 'Catlin'); $IRC->addbot('loli.catl.in', 'irc.swiftirc.net', 6667, '[2]Catlin', 'Catlin', 'Catlin'); $IRC->connect(); ?>