PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : phpirc mit mysql, problem


Meistar
09.12.2001, 20:52
Hi,

ich habe folgendes Problem mit phpirc, vielleicht versteht jemand ja den code :). Wenn ich meinem phpirc bot "gogogo" sage soll er die neuesten threads in den channel #news posten.



function privmsg_callback($code, $nick, $identd, $host, $destination, $text)
{
global $wanted_nick, $db_name, $table_name, $timedone;

if($text == ".die") { irc_disconnect("Quit request received"); }

if($text == "gogogo") {

$mysql_result = mysql_db_query($db_name, "SELECT * FROM `bb1_posts` ORDER BY `posttime` DESC LIMIT 0, 30");
if(!$mysql_result)
return;

$done=$timedone;
while(($posttopic = mysql_fetch_object($mysql_result)))
{

if (($posttime->posttime) > $timedone)x
{
irc_privmsg("#news","Neuer Thread: ".$posttopic->posttopic);

if (($posttime->posttime) > $done)
{
$done=$posttime->posttime;
}

}
}
$timedone=$done;
}

}

.........

irc_add_callback(IRCCB_ONPRIVMSG, "privmsg_callback");