Please do not hijack. Feel free to create a new thread and reference this if needed.ch1zra wrote:this is awesome
I'm a former mIRC scripter that finaly decided to move on to php, so the first logical step was to make a php irc bot :]
I've found this tutorial and it was pretty basic and easy to understand, but i have a problem now.
the bot connects and echoes all that is being said in channel, but if i refresh bot.php page in my browser, it gets stuck and bot dies.
so i was wondering how to fix this algorhytm :now, i've noticed that this is quite old thread, so I dont rly know will some1 answer, but it would be great to get some helpCode: Select all
accessing bot.php via browser if (bot is already connected to server) { just start displaying echo msgs from server } else { connect to irc server start echoing msgs from server }
thanx in advance :]
PHP IRC Bot Class
Moderator: General Moderators
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Re: PHP IRC Bot Class
Re: PHP IRC Bot Class
I apologise, it was not my intention to hijack.
Re: PHP IRC Bot Class
Does this really works? I've tried many IRC Bots! None of those worked! DamN
- markusn00b
- Forum Contributor
- Posts: 298
- Joined: Sat Oct 20, 2007 2:16 pm
- Location: York, England
Re: PHP IRC Bot Class
This has possibly been brought up already - I haven't read the whole discussion.
You are not surrounding your array indexes with quotes, be it single or double. Now, while you may have error reporting off, this still incurs overhead as the PHP engine sees these identifiers that have no literal meaning to the engine. It first checks to see if there are any constants of the same name, and then, as a fallback, replaces them with a string of the same value, that is, bot becomes the string 'bot'. Whereas, if you (and you most certainly should) wrap the indexes with quotes (more preferably single - no parsing occurs on the string) the PHP engine knows it is a string. This is not only good practice, it is the correct way to do it. Think of the whole 'bug or feature?' discussion.
Mark.
You are not surrounding your array indexes with quotes, be it single or double. Now, while you may have error reporting off, this still incurs overhead as the PHP engine sees these identifiers that have no literal meaning to the engine. It first checks to see if there are any constants of the same name, and then, as a fallback, replaces them with a string of the same value, that is, bot becomes the string 'bot'. Whereas, if you (and you most certainly should) wrap the indexes with quotes (more preferably single - no parsing occurs on the string) the PHP engine knows it is a string. This is not only good practice, it is the correct way to do it. Think of the whole 'bug or feature?' discussion.
Mark.