All pastes #395064 Raw Edit

Something

public php v1 · immutable
·published 2007-03-14 19:39 UTC
rendered paste body
$nickname = "Beta-452";$channel = "#Devcol,#betabots";$username = "Beta";$server = "irc.devcollective.com";$port = 6667;$socket = fsockopen($server, $port);set_time_limit(0);if (!$socket) {printf("Could not connect to $server");} else {cmd_send("USER ".$username." da da da");cmd_send("NICK ".$nickname);$firsttime = true;while (!feof($socket)) {$data = trim(fgets($socket, 4096));print date("[d/m @ H:i]")."<- ".$data ."\n";if(substr($data, 0, 6) == 'PING :') {cmd_send('PONG :'.substr($data, 6));if ($firsttime == true) {cmd_send("JOIN ".$channel);$firsttime = false;}}}echo gettok($data, ' ', 4);if ($old_buffer != $data) {if (gettok($data, ' ', 4) == ':!hi') {echo "yo";cmd_send("PRIVMSG #betabos :hi");}}$old_buffer = $data;}function gettok($str, $tok, $n) {$strout=explode($tok, $str);  if ($n == 0) return count($strout);  $n--; $tmpc = strlen($n) - 1;  if (substr($n, $tmpc) == "/-/") {    $i=explode("-", $n); $i=$i[0]; $i-=1;    while ($i < count($strout)) {      if (!$tmpout) $tmpout = $strout[$i];      else { $tmpout = "$tmpout $strout[$i]"; }      $i++;    }  return $tmpout;  }  return $strout[$n];}function cmd_send($command)  {global $socket;        fputs($socket, $command."\r\n");        print (date("[d/m @ H:i]") ."-> ". $command. "\n\r");}?>