PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Wed Mar 29, 2017 6:06 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 34 posts ]  Go to page Previous  1, 2, 3
Author Message
 Post subject: Re: PHP IRC Bot Class
PostPosted: Tue Nov 11, 2008 7:34 pm 
Offline
Site Admin
User avatar

Joined: Tue Dec 23, 2003 3:10 am
Posts: 11470
Location: Toronto
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 :
Syntax: [ Download ] [ Hide ]
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
}


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 help :)
thanx in advance :]


Please do not hijack. Feel free to create a new thread and reference this if needed.


Top
 Profile  
 
 Post subject: Re: PHP IRC Bot Class
PostPosted: Wed Nov 12, 2008 7:11 am 
Offline
Forum Newbie

Joined: Wed Oct 15, 2008 12:20 am
Posts: 2
I apologise, it was not my intention to hijack.


Top
 Profile  
 
 Post subject: Re: PHP IRC Bot Class
PostPosted: Wed Sep 09, 2009 2:36 am 
Offline
Forum Commoner
User avatar

Joined: Sat Sep 05, 2009 11:18 pm
Posts: 54
Location: Maldives
Does this really works? I've tried many IRC Bots! None of those worked! DamN


Top
 Profile  
 
 Post subject: Re: PHP IRC Bot Class
PostPosted: Sun Oct 11, 2009 3:22 pm 
Offline
Forum Contributor
User avatar

Joined: Sat Oct 20, 2007 2:16 pm
Posts: 298
Location: York, England
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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 34 posts ]  Go to page Previous  1, 2, 3

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group