Recent Topics

Bad Behaviour for b2evolution

Started by on Jun 09, 2009 – Contents updated: Dec 26, 2013

Jun 09, 2009 19:41    

Hi all. I've made a version of bad behaviour to b2evolution. It should work with 2.4.x and 3.x series.

You can download it at:

Bad Behaviour is a tool to prevent referer (and a lot of types) of spam.

"Bad Behavior is a unique way of blocking link spam and the robots which deliver it to your blog, forum, wiki or CMS. It operates in a completely different manner from other spam prevention services and is meant to operate alongside and in conjunction with other spam prevention software."

More at:

Let me know if it works for you! The plugins provides a widget too, to show to the world how many spams bad behaviour blocked. Look at for a sample (I'm using this plugin for some weeks).

Jun 13, 2009 00:36

An easy installation, goodness knows what it's blocking but it's busy blocking after being installed for a couple of minutes.
Widget works just fine.

Would loading the JS at the bottom of the page effect it at all?

Thanks for the work

Jun 13, 2009 00:56

Great to see!

BTW, you have a great layout ;)

And, yesterday, they released a new version of bad behaviour :(, so I need to update the plugin!

You can see in the log table created by the plugin what is being blocked. By example, i got some requests on urls like these: /?page=../../../../../../../../../../../../../../.... . What the plugion does is try to track some patterns: if you send some header (by example, a browser version) but don't send another header that is typical from this browser, you will be blocked. Some kind of euristic analysis ;)

Jun 13, 2009 01:00

Ok, thanks Walter.
I look forward to the update, and will inspect the log table after it's been running for a while.

I'll also edit the plugin and load the JS into the footer, out of curiosity.

Jun 13, 2009 01:01

right, will try the javascript on the foot. this is due to performance issues?

Jun 13, 2009 01:05

you should look atthe kkey column in the table (I had problems naming it as key, as b2evolution will supose that this is a index and will try to fuzz the things..). Everything that has a non 00000000 code was blocked, and you can search the codes in bad-behavior/

Jun 13, 2009 01:11

right, will try the javascript on the foot. this is due to performance issues?

Yes, there's so much stuff gets loaded with these all these plugins that it's bound to effect page load to some extent...

Jun 13, 2009 10:58

I have installed the plugin as well and it was pretty interesting to see things starting to get blocked within a short space of time :-)

I was thinking that it would be nice not to have to include the widget on the front end of the blog to see the stats. Maybe a tab on the tools menu or something like that? I can have a go at coding that up if you like.


Jun 13, 2009 13:22

I almost agree Lee, however some indication that "blocking" is going on ( the widget ) gives someone accidentally blocked an opportunity to contact you on the matter.

Jun 13, 2009 13:31

Hi John

True I guess although I don't know what happens when some who shouldn't be blocked is blocked. Do they even get your blog or are they just shut out? If they are just shut out they won't see the widget anyway :-)

I wasn't thinking of having one at the exclusion of the other. I think both would be good.

Jun 20, 2009 17:28

@lturner go ahead with the tab in the tools menu!

@John javascript on the footer works well?

Jun 23, 2009 11:23

Hi Walter

I had a little play with this last night. I wasn't sure what you had in mind but I thought it would be nice to be able to see a little more detail in the back end rather than just the count that is displayed in the widget. Here is the code I have added and seems to be working OK on my blog:


function AdminAfterMenuInit()
    $this->register_menu_entry( 'Bad Behaviour' );
  function AdminTabPayload()
    global $DB, $baseurl;
    $query = "SELECT * FROM " . $this->get_sql_table('bad_behavior') . " WHERE `kkey` NOT LIKE '00000000'";
    $blocked_list = $DB->get_results( $query );
    echo '<h2>'.$this->T_('Bad Behaviour has blocked the following access attempts in the last 7 days').'</h2>';
    $count = 0;
    foreach( $blocked_list as $access_attempt ) {
    echo '<table class="grouped" cellspacing="0">';
    echo '<tbody>';
    echo '<tr>'."\n";
    echo '<th width="10%">'. $this->T_('IP') . '</th>';
    echo '<td><a href="'. $access_attempt->ip .'" title="' . $this->T_('More information about this ip address') . '">'. $access_attempt->ip .'</a></td>'."\n";
    echo '</tr>'."\n";
    echo '<tr>'."\n";
    echo '<th width="10%">'.$this->T_('Date').':</th>';
    echo '<td>'. $access_attempt->date .'</td>'."\n";
    echo '</tr>'."\n";
    echo '<tr>'."\n";
    echo '<th width="10%">'.$this->T_('Request URI').':</th>';
    echo '<td><a href="' . $baseurl . $access_attempt->request_uri .'" title="' . $this->T_('View this uri on your blog') . '">'. $access_attempt->request_uri .'</a></td>'."\n";
    echo '</tr>'."\n";
    echo '<tr>'."\n";
    echo '<th width="10%">'.$this->T_('HTTP Headers').':</th>';
    echo '<td>'. $access_attempt->http_headers .'</td>'."\n";
    echo '</tr>'."\n";
    echo '<tr>'."\n";
    echo '<th width="10%">'.$this->T_('User Agent').':</th>';
    echo '<td>'. $access_attempt->user_agent .'</td>'."\n";
    echo '</tr>'."\n";
    echo '</tbody></table>'."\n";
    echo '<p>' . $this->T_('A total of ') . $count . $this->T_(' access attempts blocked.') . '</p>';
    echo '<p>' .$this->T_('More about ') . '<a href="">' .$this->T_('Bad Behaviour') . '</a></p>';

Hope that helps and fits in with the new version of the plugin you are doing.


Jun 23, 2009 16:16

Great lturner! Just added a nl2br around $access_attempt->http_headers

Jun 23, 2009 16:24

Excellent, good idea. Obviously feel free to change it in any other way you see fit - layout, content etc.

Thanks for a great plugin :)


Jun 23, 2009 16:47

Just need to test if the javascript works well on footer

Jan 02, 2010 09:25

Hey guys. Has this been updated? I added the code for the tools menu, but it returned an error. Where do you add it?

I really need something like this as Inmotion is considering kicking me off unless I reduce the bot load.

Jan 02, 2010 14:49

I will test it on the monday and hopefully release the latest version!

Jan 06, 2010 04:23

you know what's weird? Something turns off this and he bot-trap plug-in.

Jan 06, 2010 19:29

I will in about an hour.

Jan 06, 2010 20:55

Works great so far. This should be a mandatory plugin. I noticed that legitimate hits, per sitemeter, has increased. I wonder if it's related.

Jan 07, 2010 06:07

It works fine except that apparently there's a way to disable it from the outside. It just happened.

Jan 07, 2010 23:53

Error message show up when previewing posts. No big deal.

Jan 18, 2010 03:27

anybody know why this plugin disables without my intervention? Is it some spammer trick?

Jan 18, 2010 13:39

it's strange... Don't happens with me (but I don't have a great level of hits...)

Will research!

What's the error message in post preview?

Jan 18, 2010 20:30


Notice: Undefined index: offsite_forms in /home/nelson14/public_html/plugins/bad_behaviour_plugin/bad-behavior/ on line 33
Warning: Cannot modify header information - headers already sent by (output started at /home/nelson14/public_html/plugins/bad_behaviour_plugin/bad-behavior/ in /home/nelson14/public_html/plugins/bad_behaviour_plugin/bad-behavior/ on line 8
Warning: Cannot modify header information - headers already sent by (output started at /home/nelson14/public_html/plugins/bad_behaviour_plugin/bad-behavior/ in /home/nelson14/public_html/inc/_core/_template.funcs.php on line 59
ShareThis ShareThis

Jan 18, 2010 22:32

Ok, will solve this tomorrow.

Aug 04, 2010 00:59

Any plans on updating this?

Aug 04, 2010 01:22

It's working well for me, do you have some problem nelsonguirado?

I will check if the original bad behaviour has some update :)

Dec 19, 2013 06:18

@waltercruz wrote earlier:

You can get 0.4 here:

It contains bad behaviour 2.0.36

Can you test it?

Are you still working on this? I started on my own fork (of 0.2) a few years ago when your page about it disappeared? It's [url=]on github[/url]. I found this thread from a web search after I had done some bug fixes and feature enhancements and had wondered how much the source has changed since 0.2. I've added the new code from 0.4 to the plugin (but I haven't pushed the commits to github yet), but it would be redundant to have two versions, so I would like to join the development if you don't mind. Someone also needs to update the version available in the evocms-plugins SourceForge page. It's still 0.2!

One thing I'm curious about, though, is what the significance of 2008-12-08 14:27:46 is. It seems like a pretty random default date. IMHO, it might be better to set it to b2evolution's $app_date (if the default 0000-00-00 00:00:00 is somehow unsuitable).

BTW, I've noticed that two of the bugs I fixed (but again, haven't pushed yet) in the past few days are still present in your 0.4:
1. The Bad Behaviour "running time" will almost always be 0.000, because it's calculated during the parsing of the file instead of after the running of Bad Behaviour. The calculations should be moved to BeforeBlogDisplay() for an accurate estimate.
2. In GetDefaultSettings(), bb2_read_settings() is called after the function returns and thus is unreachable code.

Dec 19, 2013 20:17

Hi zooplash. I can find my old code and post it somewhere. I'm not using b2evolution anymore. :)

Dec 19, 2013 20:20

BTW, pretty nice that you're working on it! And github is the way to go. :D

Dec 25, 2013 05:19

@waltercruz wrote earlier:

Hi zooplash. I can find my old code and post it somewhere. I'm not using b2evolution anymore. :)

That's too bad. I know what you mean, though. I still have my old mods for Wordpress plugins, though I never intend to go back. One that I should convert to b2evolution as it really is good for us OCD types is the plugin that alphabetized the categories listed on the posts, though on second thought, maybe it would make more sense to just change the SQL query to order the categories by name rather than by ID. Maybe I'll look into doing that.

Form is loading...

powered by b2evolution free blog software – This forum is powered by b2evolution CMS, a complete engine for your website.