Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/php
- <?php
- $CON[servidor] ="irc.irc-hispano.org";
- CON[puerto] ="6667";
- $CON[nick] ="BPI";
- $CON[name] ="BPI";
- CON[canal] ="#ufc";
- CON[realname] ="pepe";
- $CON[A] = 0;
- function registro ($registro)
- {
- if (eregi("PING :", $registro)) {
- unset ($registro);
- } else {
- $log = fopen ("registro.txt", "a");
- fputs ($log, $registro);
- fclose($log);}
- }
- set_time_limit(0);
- $conexion = fsockopen($CON[servidor], CON[puerto]);
- if (!$conexion){
- echo "No se pudo conectar a $servidor por el puerto $puerto";
- }
- else {
- echo "conectando...\n\n";
- fputs($conexion, "nick $CON[nick]\n\n");
- fputs($conexion, "USER $CON[nick] BPI BPI :$CONEXION[name]\n\n");
- }
- while (!feof($conexion)){
- $buffer = trim(fgets($conexion, 4096));
- print date("[d/m @ H:i]")."<- ".$buffer ."\n";
- if(substr($buffer, 0, 6) == 'PING :') {
- fputs($conexion, 'PONG :'. substr($buffer, 6)."\n\n");
- if ($CON[A] == 0){
- fputs($conexion, "JOIN CON[canal] \n\n");
- $CON[A]++;
- }
- registro ($buffer);
- }
- elseif ($old_buffer != $buffer) {
- // TIEMPO
- if (eregi("!time",$buffer) && substr($buffer, 0, 11) == ":Oskita") {
- fputs($conexion,"privmsg CON[canal] :time -> ".date("H:i:s",time())."\n\n"); }
- // VERSION
- if (eregi("!ver",$buffer) && substr($buffer, 0, 11) == ":Oskita") {
- fputs($conexion,"privmsg CON[canal] :EpiBot Versión $INFO[version]\n\n"); }
- // QUITAR
- if (eregi("!quit",$buffer) && substr($buffer, 0, 11) == ":Oskita") {
- fputs($conexion,"quit :BPI Heyyy\n\n"); }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement