Onbekend |
|
<?
/* Als jullie even willen helpen */
/* hier beginnen de problemen :P */
error_reporting (E_ALL);
set_time_limit(0);
/* \r\n voor simpel gebruik */
define ('CRLF', "\r\n");
ob_implicit_flush ();
$address = getenv ("REMOTE_ADDR");
$port = 2525;
$bncver = "0.001 alpha";
$send2server = 0;
if (($sock = socket_create (AF_INET, SOCK_STREAM, 0)) < 0) {
echo "socket_create() fehlgeschlagen: Grund: " . socket_strerror ($sock) . "\n";
}
if (($ret = socket_bind ($sock, $address, $port)) < 0) {
echo "socket_bind() fehlgeschlagen: Grund: " . socket_strerror ($ret) . "\n";
}
if (($ret = socket_listen ($sock, 5)) < 0) {
echo "socket_listen() fehlgeschlagen: Grund: " . socket_strerror ($ret) . "\n";
}
do {
/*if (($msgsock = socket_accept($sock)) < 0) {
echo "socket_accept() fehlgeschlagen: Grund: " . socket_strerror ($msgsock) . "\n";
break;
}*/
$msgsock = socket_accept($sock);
$fp = fsockopen("irc.de.quakenet.org",6667, &$err_num, &$err_msg, 30);
$Header = 'NICK ' . 'Syberon_bnc' . CRLF;
$Header .= 'USER ' . 'syberonbnc' . ' ' . 'localhost' . ' ' . 'irc.quakenet.org' . ' :' . 'phpBNC' . CRLF;
fputs($fp, $Header);
$response = '';
while (!feof($fp)) { // maak loop totdat de socket gesloten is
$response .= fgets($fp, 1024);
while (substr_count($response,CRLF) != 0) {
$offset = strpos($response, CRLF);
$data = substr($response,0,$offset);
$response = substr($response,$offset+2);
if ( substr($data,0,1) == ':' ) {
$offsetA = strpos($data, ' '); // Find first space
$dFrom = substr($data,1,$offsetA-1);
$offsetB = strpos($data, ' :');
$dCommand = substr($data,$offsetA+1,$offsetB-$offsetA-1);
$dText = substr($data,$offsetB+2);
if ( substr($dCommand,0,3) == '004' ) {
}
elseif ( substr($data,0,4) == 'PING' ) {
fputs($fp,'PONG ' . substr($data,5) . CRLF);
}
socket_write ($msgsock, ":lala 002 Sabre` :- $response");
$response == "i'm AT BNC";
}
}
} while (true);
socket_close ($msgsock);
} while (true);
socket_close ($sock);
?>
<? /* Als jullie even willen helpen */ /* hier beginnen de problemen :P */ /* \r\n voor simpel gebruik */ $address = getenv ("REMOTE_ADDR"); $port = 2525; $bncver = "0.001 alpha"; $send2server = 0; } if (($ret = socket_bind ($sock, $address, $port)) < 0) { } } do { /*if (($msgsock = socket_accept($sock)) < 0) { echo "socket_accept() fehlgeschlagen: Grund: " . socket_strerror ($msgsock) . "\n"; break; }*/ $fp = fsockopen("irc.de.quakenet.org",6667, &$err_num, &$err_msg, 30); $Header = 'NICK ' . 'Syberon_bnc' . CRLF; $Header .= 'USER ' . 'syberonbnc' . ' ' . 'localhost' . ' ' . 'irc.quakenet.org' . ' :' . 'phpBNC' . CRLF; $response = ''; while (!feof($fp)) { // maak loop totdat de socket gesloten is $response .= fgets($fp, 1024); $offset = strpos($response, CRLF ); $data = substr($response,0,$offset); $response = substr($response,$offset+2); if ( substr($data,0,1) == ':' ) { $offsetA = strpos($data, ' '); // Find first space $dFrom = substr($data,1,$offsetA-1); $offsetB = strpos($data, ' :'); $dCommand = substr($data,$offsetA+1,$offsetB-$offsetA-1); $dText = substr($data,$offsetB+2); if ( substr($dCommand,0,3) == '004' ) { } elseif ( substr($data,0,4) == 'PING' ) { } $response == "i'm AT BNC"; } } } while (true); } while (true); ?>
|