Mailinglisten-Archive |
Hallo, das sieht nicht sehr vollständig aus, kannst Du mir mal bitte eine URL zu dem Projekt/Skript nennen? Danke und Gruss Marco -----Original Message----- From: php-admin_(at)_php-center.de [mailto:php-admin_(at)_php-center.de]On Behalf Of Sebastian Nohn Sent: Friday, August 18, 2000 10:24 PM To: php_(at)_php-center.de Subject: RE: [php] ircChat unter NT Hi, > 1) du hast nicht so die Ahnung von IRC, das kann vorkommen > IRC ist ein verbindungsorientiertes TCP-Protokoll, HTTP > dagegen ist verbindungs- und statuslos, d.h. rein mit PHP > über Webseiten wird das nichts, dazu brauchst du noch irgendwo <?php # Include the IRC layer include("phpIRC.inc.php3"); include("phpIRC.php3"); $wanted_nick = ""; $wanted_server = ""; $wanted_port = 6667; $wanted_channel = ""; $irc_default_realname = "#bonn infobot | running apache/php | roxic"; $mysql_host = ""; $mysql_user = ""; $mysql_pass = ""; $mysql_database = ""; $mysql_table = "phpbot_query"; $db = mysql_pconnect("$mysql_host","$mysql_user","$mysql_pass"); $db = mysql_select_db(""); # privmsg_callback() function privmsg_callback($code, $nick, $identd, $host, $destination, $text) { if ($text == "01937141") { irc_disconnect("Ich gehe !"); } elseif ($text == "quit"){ irc_privmsg("#bonn", "$nick will mich rauswerfen ! *heul*"); } else { irc_privmsg($nick, "alles scheisse"); } } function channel_callback($code, $nick, $identd, $host, $destination, $text) { if (eregi("http://(.*)", $text, $out)) { $year = date("Y"); $month = date("m"); $day = date("d"); $hour = date("H"); $minute = date("i"); $http = "http://$out[1]"; $db = mysql_query("INSERT INTO bonn_urls (url, nick, identd, host, year, month, day, hour, minute) VALUES ('$http', '$nick', '$identd', '$host', '$year', '$month', '$day', '$hour', '$minute')"); } elseif (eregi("^!whois (.*)", $text, $out)) { $lookup = $out[1]; $whois = "whois.geektools.com"; $fp = fsockopen($whois, 43, &$errno, &$errstr, 30); if (!$fp) printf("Error: %s (%s)", $errstr, $errno); } else $lookup .= "\n"; fputs($fp, $lookup); while(!feof($fp)) { $line = fgets($fp, 128); if (!eregi("^%", $line)) { if (!eregi("GeekTools", $line)) if (!eregi("copyrighted", $line)) if (!eregi("212.227.109.51", $line)) sleep(1); irc_privmsg($nick, $line); } } } } } fclose($fp); irc_privmsg($nick, "== EOF == roxic 2000 == Running Apache/Php"); sleep(30); } } elseif (eregi("^!learn (.*) = (.*)", $text, $out)) { $year = date("Y"); $month = date("m"); $day = date("d"); $hour = date("H"); $minute = date("i"); $wort = $out[1]; $beschreibung = $out[2]; $db = mysql_query("SELECT * from bonn_learn where wort = '$wort'"); $row = mysql_fetch_array($db); if ($row["wort"] != "") { irc_privmsg($destination, "$wort gibts schon"); } else { $db = mysql_query("INSERT INTO bonn_learn (wort, beschreibung, nick, identd, host, year, month, day, hour, minute) VALUES ('$wort', '$beschreibung', '$nick', '$identd', '$host', '$year', '$month', '$day', '$hour', '$minute')"); irc_privmsg($destination, "$wort gespeichert ..."); } } elseif (eregi("^!(.*)", $text, $out)) { $wort = $out[1]; $db = mysql_query("SELECT * from bonn_learn where wort like '$wort' LIMIT 0, 30 "); $row = mysql_fetch_array($db); if ($row == "") { irc_privmsg($destination, "$wort kennich nich"); } else { $wort = $row["wort"]; $beschreibung = $row["beschreibung"]; irc_privmsg($destination, "$wort = $beschreibung (".$row["nick"].")"); } } } ignore_user_abort(1); set_time_limit(0); error_reporting(63); // initialize IRC layer if(!irc_init()) die("Initialization error.<br>"); // turn on debugging irc_set_debug_mode(0); // set our nick irc_change_nick($wanted_nick); // try to connect to server if(!irc_connect($wanted_server, $wanted_port)) die("Connection error.<br>"); // join a channel $channel_handle = irc_join($wanted_channel); // in case the join failed -> quit // the join will NOT fail in case the channel is invite-only or // a similar reason exists preventing us from getting in! if(!$channel_handle) die("Join error.<br>"); irc_add_callback(IRCCB_ONPRIVMSG, "privmsg_callback"); irc_add_callback(IRCCB_ONCHANNELMSG, "channel_callback"); // ok, this is the main loop - we don't give a break condition // here, so this will not return until we get disconnected. // the only possibility to gain control again is via callbacks. irc_idle(IRC_NOBREAK); ?> Freundliche Gruesse, Sebastian Nohn -- NeT&Trade GmbH email : s.nohn_(at)_nettrade.de TechnoPark der GMD www : http://www.nettrade.de/ Rathausallee 10 tel : +49 22 41 - 20 40 33 53757 Sankt Augustin fax : +49 22 41 - 20 40 34 Germany mobile: +49 173 - 59 64 377 -- ** Durchgehend geöffnet: http://www.php-center.de ** Die PHP-Liste: mailto:php_(at)_php-center.de http://infosoc.uni-koeln.de/mailman/listinfo/php
php::bar PHP Wiki - Listenarchive