Logro conectarme, pero tengo un par de problemas:
No logro que la informacion (lo que habla cada uno) aparezca al final, solo logro que aparezca cuando termina el script.
No se como hacer la "cajita" para que uno hable, se hacer formularios y todo, pero tendria que empezar denuevo el script cada vez que le doy "enviar"
Desde ya muchas gracias,
Koz
PD: Si es posible todo en php mejor, pero si tengo que agregar otro lenguaje lo agregare sin problemas
EDIT:
el codigo:
Código PHP:
Ver original
<?php /* --- Varibles and Config Info --- */ 'server' => 'irc.toribash.com', 'port' => 6667, 'name' => 'Kozbot', 'nick' => 'Kozzy', 'channel' => '#koz', 'logging' => false, 'warning' => false, ); // mysql if (!$link) { } if (!$db_selected) { } /* --- IRCBot Class --- */ class IRCBot { //This is going to hold our TCP/IP connection var $socket; //This is going to hold all of the messages both server and client //var $logging = true; /* Construct item, opens the server connection, logs the bot in @param array */ function __construct($config) { $this->login($config); $this->main($config); } /* Logs the bot in on the server @param array */ function login($config) { $this->send_data('USER', $config['nick'].' KozEnko '.$config['nick'].' :'.$config['name']); $this->send_data('NICK', $config['nick']); $this->join_channel($config['channel']); if($config['logging']) { //Warn that logging has been enabled if($config['warning']) { $this->send_data('PRIVMSG '.$config['channel'].' :', "Chat Logging has been [Enabled]"); } } } /* This is the workhorse function, grabs the data from the server and displays on the browser */ function main($config) { if($this->ex[0] == 'PING') { $this->send_data('PONG', $this->ex[0]); //Plays ping-pong with the server to stay connected. } //Logs the chat if($config['logging']) { $logtxt = $this->filter_log($this->ex[1], $this->ex[2], $this->ex[0], $this->get_msg($this->ex)); //Gets human readable text from irc data if($logtxt != null) { //Writes to log if it is a message } } $this->main($config); } /* --- IRCBot Class's Functions --- */ function filter_log($type, $chan, $nick, $msg) { if($type == "PRIVMSG") { } return null ; } function get_msg($n) { $message = ""; return $message; } function send_data($cmd, $msg = null) { if($msg != null) { echo '<strong>'.$cmd.' '.$msg.'</strong><br />'; } else { echo '<strong>'.$cmd.'</strong><br />'; } }l } $bot = new IRCBot($config); ?>