<?php
echo "irc="; // variable fürs textfield
ob_start();
srand ((double)microtime()*1000000);$randval = rand();
$server = gethostbyname("irc.de.quakenet.org"); // ircserver
$port = "6667";
$nick = "Testbot$randval";
$quitmess = "quitmess";
$channel = "#ucd"; //channel
$realname = "mike";
$quit= "BOOOOOTTTT GEHT";
//connect
$fp = fsockopen("$server", $port, &$errno, &$errstr);
fputs($fp, "USER $nick 2 3 :$realname\n");
fputs($fp, "NICK $nick\n");
$i = 0;
while(!feof($fp)){
$i=2;
$i++;
$zeile = fgets($fp,4094);
$wert = explode(" ", $zeile);
checkpong($wert,$fp,$channel);
echo "$i $zeile"; // ausgabe der daten im browser
ob_end_clean();
}
function checkpong($wert,$fp,$channel){
if($wert[0] == 'PING'){
fputs($fp, "PONG $wert[1]\n");
fputs($fp, "JOIN $channel\n");
}
}
?>