All pastes #542473 Raw Edit

Untitled

public text v1 · immutable
·published 2007-06-05 21:02 UTC
rendered paste body
#! /usr/local/bin/php -q
<?php

// Prevent PHP from stopping the script after 30 sec
set_time_limit(0);

// Opening the socket to the network
$socket = fsockopen("irc.firestormirc.net", 6667);

// Send auth info
fputs($socket,"USER Arcade nano-arcade.com Arcade :Arcade\n");
fputs($socket,"NICK Arcade\n");

// Join channel
fputs($socket,"JOIN #lobby\n");
fputs($socket,"JOIN #nano-arcade\n");

// Identify  to NickServ
fputs($socket, "PRIVMSG NickServ :identify arcadebot\n");

// Force an endless while
while(1) {
	// Continue the rest of the script here
	while($data = fgets($socket, 128)) {
		echo nl2br($data);
		flush();
		
		

		// Separate all data
   	$ex = explode(' ', $data);

		// Send PONG back to the server
		if($ex[0] == "PING"){ fputs($socket, "PONG ".$ex[1]."\n"); }
		
		// BotServ commands
		$command = str_replace(array(chr(10), chr(13)), '', $ex[3]);
		if ($command == ":!top") { fputs($socket, "PRIVMSG ".$ex[1]." :i work w00000000t.\n"); }
	}
}
?>