Jump to content

php irc bot problems


ch1zra

Recommended Posts

hi every1 :)

I am working on a php irc bot, and I got it working quite fine, xcept one problem.

I dont want bot to reset/reconnect every time i access bot.php page via browser, so i was wondering is there any way to do something like :

 

if (!$socket) {
    $socket = fsockopen($server, $port);
    // Send auth info
    fputs($socket,"USER MH_Bot ch1zra.com MHB :ch1zra.com PHP IRC BOT\n");
    fputs($socket,"NICK " . $botnick . "\n");
    fputs($socket,"ns identify " . $pass . "\n");

    // Join channel
    sleep(4);
    fputs($socket,"JOIN " . $chan . "\n");
    echo "Connected to " . $server . "<br>------------------------------<br>";
    // Force an endless while
    include("loop.php");
}
else {
    include("loop.php");
}

 

but bot always seems to die when i refresh/access page.

 

loop.php file contains an endless loop with flush(), which is required to continously display data coming from server.

so, what am i doing wrong, and how to do it right ? :)

 

thanx in advance.

Link to comment
https://forums.phpfreaks.com/topic/128390-php-irc-bot-problems/
Share on other sites

ok, that might do the trick, but I had in mind something like web accessible page, for few people to see...

so i can make cookies on my machine, but what if friend X, Y or Z also goes to see what is going on with bot/channel bot is on ?

that kind of fix i had in mind :)

Link to comment
https://forums.phpfreaks.com/topic/128390-php-irc-bot-problems/#findComment-665201
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.