RageBin - Collaborative Raging

Ragebin is a collaborative Raging tool allowing you to share and modify rage snippets while chatting on IRC, IM or a message board.

This site is developed to XHTML and CSS2 W3C standards. If you see this paragraph, your browser does not support those standards and you need to upgrade. Visit WaSP for a browser that supports this.

RageBin - Home - View Help - Archive - Ragers IRC - Image Boards

Posted by php bot on Tuesday 21st April 2009 23:46:07 - Never Expires
download | new post

  1. <?
  2. // define your variables
  3. $host = "irc.freesteam.org";
  4. $port=6667;
  5. $nick="n3t-Bot";
  6. $ident="n3tBot";
  7. $chan="#n3t-t3z";
  8. $readbuffer="";
  9. $realname = "plsufag";
  10.  
  11. // open a socket connection to the IRC server
  12. $fp = fsockopen($host, $port, $errno, $errstr, 30);
  13.  
  14. // print the error if there is no connection
  15. if (!$fp) {
  16.     echo $errstr." (".$errno.")<br />\n";
  17. } else {
  18.     // write data through the socket to join the channel
  19.     fwrite($fp, "NICK ".$nick."\r\n");
  20.     fwrite($fp, "USER ".$ident." ".$host." bla :".$realname."\r\n");
  21.     fwrite($fp, "JOIN :".$chan."\r\n");
  22.    
  23.     // write data through the socket to print text to the channel
  24.     fwrite($fp, "PRIVMSG ".$chan." :Hello There!\r\n");
  25.     fwrite($fp, "PRIVMSG ".$chan." :I am a bot\r\n");
  26.    
  27.     // loop through each line to look for ping
  28.      while (!feof($fp)) {
  29.          
  30.         $line =  fgets($fp, 128);
  31.         echo $line."<br />\n";
  32.        
  33.         $line = explode(":ping ", $line);
  34.        
  35.         echo $line[0]."<br />\n";
  36.  
  37.         if ($line[1]) {
  38.            
  39.             fwrite($fp, "PONG ".$line[1]."\r\n");
  40.         }
  41.         flush();
  42.     }
  43.    
  44.     fclose($fp);
  45. }
  46. ?>

Submit a correction or amendment below. (click here to post a fresh rage)
After submitting an amendment, you'll be able to view the differences between the old and new rage easily.
Syntax Highlighting:
To highlight particular lines, prefix each line with @@
Pressing TAB inserts 3 spaces