ch1zra Posted October 14, 2008 Share Posted October 14, 2008 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. Quote Link to comment https://forums.phpfreaks.com/topic/128390-php-irc-bot-problems/ Share on other sites More sharing options...
Lamez Posted October 14, 2008 Share Posted October 14, 2008 Session Variables!\Cookies! set a session variable once the page is loaded, then check to see if it set, and if it is do not reset the conneciton. Quote Link to comment https://forums.phpfreaks.com/topic/128390-php-irc-bot-problems/#findComment-665196 Share on other sites More sharing options...
ch1zra Posted October 14, 2008 Author Share Posted October 14, 2008 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 Quote Link to comment https://forums.phpfreaks.com/topic/128390-php-irc-bot-problems/#findComment-665201 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.