rendered paste body<?php$c = fsockopen ("brown.freenode.net", 6667);fputs($c, "USER fax_bot 0 * :fax_bot\n");fputs($c, "NICK fax_bot\n");fputs($c, "JOIN #phpbitch\n");function between($string, $left, $right) { return substr($string, strpos($string, $left)+strlen($left), strpos($string, $right)-strpos($string, $left)-strlen($left));}while (!feof($c)) { $new = fgets($c); echo $new; $e = explode(":", $new, 3); $f = explode(" ", $e[1]); print_r($f); print_r($e); $check = 'fax_bot: '; if($f[1] == 'PRIVMSG') { if($f[2] == 'fax_bot') { $nick = substr($e[1], 0, strpos($e[1], '!')); $msg = trim($e[2]); $query = $msg; $chan = $nick; } else if(substr($e[2], 0, strlen($check)) == $check) { $nick = substr($e[1], 0, strpos($e[1], '!')); $msg = trim($e[2]); $query = str_replace('fax_bot: ', '', $msg); $chan = $f[2]; } else { continue; } switch($query) { case 'die': case 'quit': case 'goodbye': case 'scram': case 'fuck off': case 'exit': case 'beat it': case 'buggar off': case 'gtfo': case 'go away': case 'begone!': if($nick == 'fax_machine') fputs($c, "PRIVMSG $chan :$nick: Toodles!\nQUIT\n"); else fputs($c, "PRIVMSG $chan :$nick: Pfft, no.\n"); break; case substr($query, 0, 5) == 'tell ': $bits = explode(" ", $query); $dest = $bits[1]; $tmp = array(); $tmp = array_slice($bits, 2); $msg = implode(" ", $tmp); fputs($c, "PRIVMSG $dest :$nick told me to tell you: $msg\n"); fputs($c, "PRIVMSG $chan :$nick: OK, done.\n"); break; case substr($query, 0, 5) == 'join ': $bits = explode(" ", $query); $dest = $bits[1]; fputs($c, "JOIN $dest\n"); break; case substr($query, 0, 5) == 'part ': $bits = explode(" ", $query); $dest = $bits[1]; fputs($c, "PART $dest :Requested by $nick\n"); break; case substr($query, 0, 10) == 'translate ': $bits = explode(" ", $query); $pair = $bits[1]; $tmp = array(); $tmp = array_slice($bits, 2); $phrase = implode(" ", $tmp); $phrase = str_replace(" ", "%20", $phrase); #echo $pair.'$$$'.$phrase; if($pair == 'lol') { $ua = 'Mozilla/5.0'; $url = 'http://babelfish.altavista.com/tr?doit=done&intl=1&lp=en_de&tt=urltext&trtext='.$phrase; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HEADER, false); curl_setopt($ch, CURLOPT_USERAGENT, $ua); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $d = curl_exec($ch); curl_close($ch); $l = '<div style=padding:10px;>'; $r = '</div></td>'; $response = between($d, $l, $r); $response = strip_tags($response); $response = str_replace(" ", "%20", $response); $ua = 'Mozilla/5.0'; $url = 'http://babelfish.altavista.com/tr?doit=done&intl=1&lp=de_en&tt=urltext&trtext='.$response; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HEADER, false); curl_setopt($ch, CURLOPT_USERAGENT, $ua); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $d = curl_exec($ch); curl_close($ch); $l = '<div style=padding:10px;>'; $r = '</div></td>'; $response = between($d, $l, $r); $response = strip_tags($response); $response = str_replace(" ", "%20", $response); $ua = 'Mozilla/5.0'; $url = 'http://babelfish.altavista.com/tr?doit=done&intl=1&lp=en_zh&tt=urltext&trtext='.$response; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HEADER, false); curl_setopt($ch, CURLOPT_USERAGENT, $ua); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $d = curl_exec($ch); curl_close($ch); $l = '<div style=padding:10px;>'; $r = '</div></td>'; $response = between($d, $l, $r); $response = strip_tags($response); $response = str_replace(" ", "%20", $response); $ua = 'Mozilla/5.0'; $url = 'http://babelfish.altavista.com/tr?doit=done&intl=1&lp=zh_en&tt=urltext&trtext='.$response; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HEADER, false); curl_setopt($ch, CURLOPT_USERAGENT, $ua); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $d = curl_exec($ch); curl_close($ch); $l = '<div style=padding:10px;>'; $r = '</div></td>'; $response = between($d, $l, $r); $response = strip_tags($response); if(strlen($response)>500) { fputs($c, "PRIVMSG $chan :$nick: Don't know.\n"); } else { fputs($c, "PRIVMSG $chan :$nick: $response\n"); } continue; } $ua = 'Mozilla/5.0'; $url = 'http://babelfish.altavista.com/tr?doit=done&intl=1&lp='.$pair.'&tt=urltext&trtext='.$phrase; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HEADER, false); curl_setopt($ch, CURLOPT_USERAGENT, $ua); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $d = curl_exec($ch); curl_close($ch); $l = '<div style=padding:10px;>'; $r = '</div></td>'; $response = between($d, $l, $r); $response = strip_tags($response); if(strlen($response)>500) { fputs($c, "PRIVMSG $chan :$nick: Don't know.\n"); } else { fputs($c, "PRIVMSG $chan :$nick: $response\n"); } break; default: $query = str_replace(' ', '+', $query); $ua = 'Mozilla/5.0'; $url = 'http://www.google.com/search?hl=en&q='.$query.'%3F&btnG=Google+Search'; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HEADER, false); curl_setopt($ch, CURLOPT_USERAGENT, $ua); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $d = curl_exec($ch); curl_close($ch); $l = '</a> — '; $r = '</h2><br>'; $response = between($d, $l, $r); $response = strip_tags($response); if(strlen($response)>500) { fputs($c, "PRIVMSG $chan :$nick: Don't know.\n"); } else { fputs($c, "PRIVMSG $chan :$nick: $response\n"); } break; } }}fclose($fp);?>