Advertisement
Guest User

Untitled

a guest
Apr 27th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.50 KB | None | 0 0
  1. #!/usr/bin/php
  2. <?php
  3. $CON[servidor] ="irc.irc-hispano.org";
  4. CON[puerto] ="6667";
  5. $CON[nick] ="BPI";
  6. $CON[name] ="BPI";
  7. CON[canal] ="#ufc";
  8. CON[realname] ="pepe";
  9. $CON[A] = 0;
  10.  
  11. function registro ($registro)
  12. {
  13. if (eregi("PING :", $registro)) {
  14. unset ($registro);
  15. } else {
  16. $log = fopen ("registro.txt", "a");
  17. fputs ($log, $registro);
  18. fclose($log);}
  19. }
  20.  
  21. set_time_limit(0);
  22.  
  23. $conexion = fsockopen($CON[servidor], CON[puerto]);
  24.  
  25. if (!$conexion){
  26. echo "No se pudo conectar a $servidor por el puerto $puerto";
  27. }
  28. else {
  29. echo "conectando...\n\n";
  30. fputs($conexion, "nick $CON[nick]\n\n");
  31. fputs($conexion, "USER $CON[nick] BPI BPI :$CONEXION[name]\n\n");
  32. }
  33.  
  34. while (!feof($conexion)){
  35.  
  36. $buffer = trim(fgets($conexion, 4096));
  37.  
  38. print date("[d/m @ H:i]")."<- ".$buffer ."\n";
  39. if(substr($buffer, 0, 6) == 'PING :') {
  40. fputs($conexion, 'PONG :'. substr($buffer, 6)."\n\n");
  41. if ($CON[A] == 0){
  42. fputs($conexion, "JOIN CON[canal] \n\n");
  43. $CON[A]++;
  44. }
  45. registro ($buffer);
  46. }
  47. elseif ($old_buffer != $buffer) {
  48.  
  49. // TIEMPO
  50. if (eregi("!time",$buffer) && substr($buffer, 0, 11) == ":Oskita") {
  51. fputs($conexion,"privmsg CON[canal] :time -> ".date("H:i:s",time())."\n\n"); }
  52. // VERSION
  53. if (eregi("!ver",$buffer) && substr($buffer, 0, 11) == ":Oskita") {
  54. fputs($conexion,"privmsg CON[canal] :EpiBot Versión $INFO[version]\n\n"); }
  55. // QUITAR
  56. if (eregi("!quit",$buffer) && substr($buffer, 0, 11) == ":Oskita") {
  57. fputs($conexion,"quit :BPI Heyyy\n\n"); }
  58.  
  59. }
  60. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement