All pastes #744028 Raw Edit

Untitled

public php v1 · immutable
·published 2007-10-21 00:30 UTC
rendered paste body
<?phpclass bot { var $socket; var $nick = "Obian"; var $channel = "#Obian"; 	//Connect to server	public function cnnct() 	{	$this->socket = fsockopen("irc.hackthissite.org", 6667);	fputs($this->socket,"USER $this->nick ziandia.com XX :$this->nick \n");        fputs($this->socket,"NICK $this->nick\n");  	fputs($this->socket,"JOIN $this->channel\n");	}	//Respond to PINGS	public function ping($responsecode)	{	 fputs($this->socket, "PONG ".$responsecode."\n");	}	}class cmds extends bot {	public function sayit()	{	  fputs($this->socket, "PRIVMSG "."#meh"." :Test meh!\n");        }	}//Create bot object and connect$bot = new bot;$bot->cnnct();//Create new object to deal with commands$cmds = new cmds;$buffer = ""; // *//Force an endless loopwhile(1){	while(true)	{$buffer .= fgets($bot->socket, 512); // *$lines = explode("\n",$buffer,2); // *if (isset($lines[1])){ // *$data = $lines[0]; // *		//Seperate data	        $ex = explode(' ', $data);			echo $data;				//Respond to PINGS		if($ex[0] == "PING")		$bot->ping($ex[1]);				//Trim \n\r's		//$command = rtrim($ex[3]);				if($ex[3] == ":!sayit")		$cmds->sayit();}	}}?>