I'm hoping someone can help me with this.... I'm using a script called phpircchat....
I have it connecting to the server, displaying usernames and there's message coming from the server to the chat page (via mIRC)...
I've managed to get the message input to the php file to send to IRC "PRIVMSG" however i'm having difficulty in getting this to work and i'm hoping someone could possibly show me where i'm going wrong as i've spent nearly two weeks getting to this point...
//IRC Functions
function irc_write($socket, $msg) {
global $mode;
if ($mode == 1) {
return @fputs($socket, $msg);
} elseif ($mode == 2) {
return socket_write($socket, $msg);
}
}
function irc_nb($socket) {
global $mode;
if ($mode == 1) {
return socket_set_blocking($socket, false);
} elseif ($mode == 2) {
socket_set_nonblock($socket);
}
}
function irc_open($serv_addr, $serv_port, $errno, $errstr) {
global $mode;
if ($mode == 1) {
return fsockopen($serv_addr, $serv_port, $errno, $errstr);
} elseif ($mode == 2) {
$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
socket_connect($socket, $serv_addr, $serv_port);
return $socket;
}
}
// POSTED FROM CHAT INPUT TO PHP FILE
$channel = $_POST['channel'];
$channel = '#'.$channel.'';
$cmd = $_POST['cmnd'];
set_time_limit(0);
$socket = irc_open($serv_addr, $serv_port, $errno, $errstr);
irc_nb($socket);
$command = "PRIVMSG $channel :$cmd\n";
irc_write($socket, $command);
I'd be very greatful to anyone who can help please, would really like to have this functioning