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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.