We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Bad Behavior 2 - Extension

Development and Programming

Sim's avatar
Sim
8 posts
18 years ago
Sim's avatar Sim

Hopefully EE native anti spam features would take care of such bot. It’s just a suggestion to avoid potential annoying errors for granted users.

       
Sim's avatar
Sim
8 posts
18 years ago
Sim's avatar Sim

Looking at BB’s tables in the SQL manager, I noticed that all dates are 0000-00-00 00:00:00 and all keys are 00000000. Michael Hampton says it’s not normal and I should report to you.

       
Paul Burdick's avatar
Paul Burdick
480 posts
18 years ago
Paul Burdick's avatar Paul Burdick

Ah, it is this function in the extension:

// Return current time in the format preferred by your database.
function bb2_db_date() {
    global $LOC;
    return $LOC->now;    // Example is MySQL format
}

The top note makes it sound like any date format will be accepted so I put in a Unix timestamp set for GMT, which is the standard way EE does dates, but he is using the MySQL field type ‘datetime’, which will only accept that one format. Bother. Try replacing that function with this new one below, and I will update the download too:

// Return current time in the format preferred by your database.
function bb2_db_date() {
    global $LOC;
    return date('Y-m-d h:i:s', $LOC->now);     // Example is MySQL format
}
       
Luke Stevens's avatar
Luke Stevens
80 posts
18 years ago
Luke Stevens's avatar Luke Stevens

Hey Paul, I tried adding this to a couple of sites on different hosts, both running 1.4.2, but I get the following errors when posting a comment (the comment goes through though):

Notice: Undefined variable: screener2 in /home/blah/system/public_html/cp/extensions/bad-behavior/post.inc.php on line 32 Notice: Undefined property: num_rows in /home/blah/system/public_html/cp/extensions/ext.bad_behavior.php on line 68 Warning: Cannot modify header information - headers already sent by (output started at….

I’m using 2.0.5 of Bad Behavior. Is this something I should take up with the BB guys, or something to do with the extension (or something I missed!)? I wondered if the newer version of BB might be to blame, but apparently there’s a fix for EE in there.

Thanks!

       
Paul Burdick's avatar
Paul Burdick
480 posts
18 years ago
Paul Burdick's avatar Paul Burdick

Well, that first error reminds me of an error BB 2 had in their code, and their suggestion was to simply turn off error reporting. I see that they are on version 2.06 now, so perhaps try upgrading and seeing if the error goes away? As for the second, it seems something is going wrong with the abstraction layer. Do not recall this happening previously, so I can only hope it is on their site as I do not want to go through all of their code to find where it might be going awry. So, upgrade?

       
Luke Stevens's avatar
Luke Stevens
80 posts
18 years ago
Luke Stevens's avatar Luke Stevens

Thanks Paul, I gave upgrading to 2.0.6 a try but the errors remained, however I found when I turned off error reporting as per sigork’s comment on this post that seemed to do the trick, insofar as there’s no longer errors being reported! I’m only getting the occasional spam on a couple of sites and using it pre-emptively on another, so I guess I’ll just wait and see what happens.

Cheers!

       
Luke Stevens's avatar
Luke Stevens
80 posts
18 years ago
Luke Stevens's avatar Luke Stevens

BTW I think there’s a small bug in the extension with verbose logging not being set to off, despite it appearing to be off by default. I noticed that all requests were being logged until I went into the settings and hit ‘submit’, which stopped the normal requests being logged.

       
Paul Burdick's avatar
Paul Burdick
480 posts
18 years ago
Paul Burdick's avatar Paul Burdick
BTW I think there’s a small bug in the extension with verbose logging *not* being set to off, despite it appearing to be off by default. I noticed that all requests were being logged until I went into the settings and hit ‘submit’, which stopped the normal requests being logged.

Could you expand on this more? Hitting Submit?

       
Luke Stevens's avatar
Luke Stevens
80 posts
18 years ago
Luke Stevens's avatar Luke Stevens

Sure, sorry I meant hitting submit on the bad behavior extension settings page.

So basically what was happening was…

I was keeping an eye on the exp_bad_behavior table & I noticed ordinary requests for the home page etc were being logged.

When I went to Admin > Utils > Extensions Manager > Bad Behaviour settings, ‘Verbose’ appears to be set to ‘Off’, however the behavior of the extension is as though verbose logging is ‘on’. Without changing any of the extension settings (they all appear to be set to ‘off’ by default), I hit submit, which seemed to change the behavior of the extension so verbose logging stopped.

Hope that’s clearer :)

       
Paul Burdick's avatar
Paul Burdick
480 posts
18 years ago
Paul Burdick's avatar Paul Burdick

OK, so it seems that no matter the default setting, the extension settings was showing it incorrectly. I can look into that. Whee!

       
Paul Burdick's avatar
Paul Burdick
480 posts
18 years ago
Paul Burdick's avatar Paul Burdick

I have updated the downloadable files. It was a case of me not inserting default settings and thus the default Bad Behavior settings were being used (everything turned on).

       
Luke Stevens's avatar
Luke Stevens
80 posts
18 years ago
Luke Stevens's avatar Luke Stevens

That was alarmingly fast, thanks Paul :)

       
JT Thompson's avatar
JT Thompson
745 posts
18 years ago
JT Thompson's avatar JT Thompson

I’m still getting the blank page when I enable this. Is this due to a newer version of EE?

       
David Webb's avatar
David Webb
62 posts
18 years ago
David Webb's avatar David Webb

I just installed this on the latest EE and it worked (well installed fine)

I was a bit confused by which folder to upload in the extensions.

It needs to be the 2nd folder named “bad-behavior” the one at the same level as the readme not the one including the readme.

Hope this helps.

       
JT Thompson's avatar
JT Thompson
745 posts
18 years ago
JT Thompson's avatar JT Thompson

LOL I’m sure it’s my fault. there was no folder in the zip i donwloaded. there was only two files. the main file and the language file.

Do you have a link to the right file to donwload?

       
1 2 3 4 5

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.