Recent Topics

1 Jan 29, 2005 23:39    

This comes from [url=]a request in the Feature request forum[/url] about antispam checking what it updates. It would be really cool if updating antispam included a re-check of everything it added, or at the very least asked you "do you want to re-check the new things?". The latter is a step above what I hacked in. This hack involves a new field in the antispam table and modifications to admin/b2antispam.php and b2evocore/_functions_antispam.php. The end result is that any banned keywords I haven't actually clicked "re-check" on tell me "NOT rechecked!" in the back office. It also sorts with the not rechecked keywords on the top so I can easily see which words got added with the latest update. I wrote up all the hackage in detail [url=]on my blog[/url], and for those who don't need the details here's the quickie:

New field:

ALTER TABLE `evo_antispam` ADD `aspm_checked` ENUM( 'needs', 'gotit' ) DEFAULT 'needs' NOT NULL

Change _functions_antispam:

$sql = "SELECT aspm_ID, aspm_string, aspm_source, aspm_checked
FROM $tableantispam
ORDER BY aspm_checked ASC, aspm_string ASC";
$res_stats = $DB->get_results( $sql, ARRAY_A );

Change b2antispam:

if( $recheck > 0 ) {
$sql = "UPDATE $tableantispam SET aspm_checked='gotit' WHERE aspm_ID = $recheck";
$result = $DB->query( $sql );

if( $delhits && $deluxe_ban )


[blahblahblah T_('Check hit-logs and comments for this keyword!') blahblahblah]
<?php $been_rechecked = $row_stats['aspm_checked'];
if( $been_rechecked == 'needs' ) {
echo 'NOT rechecked!';
} else {
echo ' ';

4 Feb 07, 2005 22:54

EdB, please keep the code pieces

	<?php $been_rechecked = $row_stats['aspm_checked'];
	if( $been_rechecked == 'no' ) {
	echo 'NOT rechecked!';
	} else {
	echo 'was rechecked! ';

5 Feb 07, 2005 23:50

Ya think so? I felt it was redundant because having "re-check" means it's not been re-checked. Oh wait a minute. On the short table it's intuitive because if it shows up then it must be not rechecked. On the full (original) table there's no explanation of what's been done or not, so it makes sense to add a reference to the checked/notrechecked status of each keyword.

Lemme know what you think and I'll work it back in.

6 Feb 08, 2005 00:04

		<?php } else {
		echo '&nbsp;';
		} ?>

	<?php if( $show_full ) { ?>
		<?php $been_rechecked = $row_stats['aspm_checked'];
		if( $been_rechecked == 'no' ) {
			echo '<strong>NOT re-checked!</strong>';
			} else {
			echo 're-check done';
			} ?>
		<?php } ?>

	} // End stat loop ?>

Add it to the tail end of the new file. You will get the extra column when you decide to view the full list of banned keywords, un-re-checked items will be flagged with bold, and re-checked items will be regular font. I'll update my blog post and associated files too.

Hope this addresses your concern.

7 Jun 16, 2005 07:12

I've been using EdB's hack for a while now and love it but it broke with so I've updated it to version 4.

You can download the hack and instructions from [url=]this location[/url] until I setup a more permanent home.

If you run into problems with the installation or fuction of the hack please post and I'll do my best to assist you.


8 Jun 16, 2005 07:19

You don't have permission to access /ben/ on this server.

9 Jun 16, 2005 07:27

Should be fixed now.

10 Jun 23, 2005 16:30

MySQL error!

Unknown column 'aspm_checked' in 'field list'(Errno=1054)

Your query:
SELECT aspm_ID, aspm_string, aspm_source, aspm_checked FROM evo_antispam WHERE aspm_checked = 'FALSE' ORDER BY aspm_string ASC

Anyone any ideas?

I've added the field into the database,

Field Type Attributes Null Default Extra Action
aspm_ID bigint(11) No auto_increment Change Drop Primary Index Unique Fulltext
aspm_string varchar(80) No Change Drop Primary Index Unique Fulltext
aspm_source enum('local', 'reported', 'central') No reported Change Drop Primary Index Unique Fulltext
aspm_checked tinyint(1) No 0

But no cigar for me! .... executing the SQL command in MyPhpAdmin is successful.

11 Jun 24, 2005 00:54

Check your hacks.php file. It should have a line like

$sql = "SELECT aspm_ID, aspm_string, aspm_source, aspm_checked 
FROM $tableantispam 
WHERE aspm_checked = '0' 
ORDER BY aspm_string ASC";
$res_stats = $DB->get_results( $sql, ARRAY_A );

If the line says WHERE aspm_checked = 'FALSE' change it. You should be using 0 and 1 in the queries, not TRUE and FALSE. I beleive this is the only place that query appears.

Let us know what you find.

12 Aug 03, 2005 13:53

EDB/Anyone - have you thought about automating the update process so that I could call a cron job that automatically does a recheck & prune every X hours?

Currently, manual intervention is the only way, and you need to recheck for every unchecked entry.

13 Aug 03, 2005 17:24

Isaac made up a way to automatically get the update and do the recheck using a cron job. Check for details.

BenFranske: why do you say it didn't work in v12? I have a v12 installation that uses my last version of this hack without issue. The "yes/no" version was problematic for some situations, but that became "needs/gotit" a long time ago. Effectively the same solution as "1/0"?

14 Aug 22, 2005 21:23

Just a small modification:

if( $show_full ) {

on line 514 of you modifed b2antispam.php should read

if( $_GET['show_full'] ) {

to be register_globals off compatible - otherwise the user will never be able to see any of the keywords already checked.

15 Aug 27, 2005 16:30

I posted this in the plugins forum & EdB suggested that I try over here:

I'm getting an error when cron runs it (same if I run it manually) - (MySQL 4.0.25-standard / B2Evo / php ver: 4.3.10

Parse error: parse error, unexpected ';' in /home/mysite/public_html/blog/admin/b2antispam_recheck.php on line 24

Here's the code referenced:

	$report = ( $result->aspm_source != 'central' &amp;&amp; $result->aspm_source != 'reported' ) ? 1 : 0;

I've done EdB's "hacks": added database field, changed "no's" to "needs" & "yes's" to "gotit" in the script.

I'm using Isaac's blacklist update cron technique successfully & would like to get the re-check working, too.

any ideas?


Comment from: EdB [Visitor] ·
Hi William. I'll try to figure something out on this, but Isaac wrote the 'automatic recheck' hack - all I did was copy it and be happy. What version of PHP are you running? Are you a member of the forums? If not you should sign up because pasting code works a lot better in there than out here.

It'll take me a while. I'm wondering about the syntax of that particular line. How it says "variable = this or that depending on a condition". I'm thinking maybe your PHP doesn't like the way Isaac wrote the code? It'd be odd because Isaac is really good with code, but I don't know what else to look at.

See you in the forums!

Comment from: EdB [Visitor] ·
Try changing "? 1 : 0;" to "? true : false;. Just a thought based on the reason I had to change yes and no to gotit and needs. I don't understand why - I just remember my hack failed with yes and no for a few people. Something about how their server was setup.

Any additional followup we'll do in the forums. Lotsa smart people in there!

Thanks for your reply, EdB

I Tried true /false, but no joy. (my php ver: 4.3.10)

Thanks for any other thoughts...

16 Aug 27, 2005 17:01

I just typed up tons of groovy stuff about apple sauce and sledgehammers only to realize exactly where your problem is. It didn't show outside in the plugins though. Maybe it did and I didn't notice? I dunno. I saw it happen on Isaac's page so I think it didn't show out there. Bummer. I thought my apple sauce sledge hammer stuff was witty. Now I'm going to have to make up a hack just to use apple and sauce as conditions for something.

'central' &amp;&amp; $result

is wrong. It came from how Isaac does the "display this page to show how cool I am" thing. Ampersands in the code got converted to the way they get converted for some reason. Some sort of entity encoded blahblah thing. Anyway make that little bit be

'central' && $result

and all should be well. You can go back to 1 and 0 as well, but true and false should also work.

17 Aug 27, 2005 17:35

Thank you, EdB!! That was the issue (also on line 38, BTW). Runs like a charm, now. That should help keep the vermin off my blog!

It came from how Isaac does the "display this page to show how cool I am" thing.

Heh, well, he is pretty cool, even if he is running WordPress these days.

I thought my apple sauce sledge hammer stuff was witty.

Well, a sledge hammer seems like the appropriate tool to use on spammers.

Thank you, again -- :D

19 Aug 30, 2005 23:25

Since adding b2antispam_poll.php & b2antispam_recheck.php hacks to one of my sites, I get the following error when attempting to manually ban referrers:

Fatal error: Call to undefined function: stats_hit_remote_addr() in /home/mysite/public_html/blogs/admin/b2antispam.php on line 127

the code referenced:

<td><?php stats_hit_remote_addr() ?></td>

This site is running with security patches, on same server as the site I posted about in the last couple posts. The previous site is running Is that the issue? I've been hunting for extra spaces at the end of the files that were changed, but they look fine. Hoping one of the gurus can point me in the right direction...i.e.: where should "stats_hit_remote_addr" function be defined??


20 Aug 30, 2005 23:47

Try searching b2evocore/_functions_antispam.php for that function name. I'm guessing you'll find it in your v12 installation but not your v10. IF that's the case you might be able to get away with just copying it from v12 to v10, but no promises! If not, meaning if the function is in your v10 then it's a total mystery to me.

Oh and when you have that file from both versions open you might want to look at some of the other functions to see if maybe any little doo-dads have changed names. Like maybe $tableantispam or some such. It's POSSIBLE that you might have to do a tiny bit of customizing the function to make it work in the v10 installation. Just something to keep an eye out for...

21 Aug 31, 2005 06:37

Close... found it in b2evocore/_functions_hitlogs.php. Only in v.12.
I was feelin' lucky, so I just copied over the v.12 version into the v.10 install and now all seems to be well. Now let's see if everything else is still working...

22 Sep 09, 2005 17:26


I've just installed this hack. Infortunately I get this error when I try to delete a spam :

Erreur MySQL!

You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1(Errno=1064)

Your query:
UPDATE evo_antispam SET aspm_checked='gotit' WHERE aspm_ID =

I've searched the solution, in vain. :(

Thanks for your help

(And sorry for my bad English !)

23 Sep 09, 2005 17:45

Hi Lunatic. I'm guessing your using my part3 hack because of the "gotit" reference. I'll get back to this when I can, but right now it looks like my web is unavailable. Can't even get to cpanel to see if it's all there still, so I'm hoping it's a server issue.

It looks like your problem is with this bit around line 55 of my modified b2antispam.php file:

	if( $recheck > 0 ) {
		$sql = "UPDATE $tableantispam SET aspm_checked='gotit' WHERE aspm_ID = $recheck";
		$result = $DB->query( $sql );

Unfortunately I can't tell you much more than that. Some questions might help. What version of b2evolution are you running? Are you sure you did the hack correctly and completely? My blog entry is not the clearest - a couple of people have missed bits and pieces in it - is why I ask.

I'll let you know via PM when my web is back online.

EDIT: I seem to be back online, so we can try to troubleshoot this problem.

24 Sep 09, 2005 18:11

Hi EdB,

I think I've correctly followed all the steps : 1/ SQL modification 2/ creation of "hacks.php" with the piece of code 3/ replacing of b2antispam.php

Apparently, the "recheck" field is empty :

<input type="hidden" name="recheck" value="" />

So I've added this simple line near the top of b2antispam.php :

$recheck = $_POST['recheck'];

And it seems to work !

25 Sep 09, 2005 19:32

That seems similar to what Pneumatus found on the first page of this thread.
Pneumatus wrote:

Just a small modification:
if( $show_full ) {

on line 514 of you modifed b2antispam.php should read
if( $_GET['show_full'] ) {

to be register_globals off compatible - otherwise the user will never be able to see any of the keywords already checked.

I don't have much of an understanding of that stuff. My knowledge on these matters runs out pretty quick - like right after something in b2evolution starts doing what I want.

Glad you got it working!!!

26 Sep 11, 2005 21:46

Yup EdB, exactly the same issue. Your host must still run with register_globals on - that basically means that when you have


The PHP parser automagically registers the variable $var1 with the value 'toot'. register_globals on is consdired to be a serious security risk, because if you fail to always assign a value to a variable before you use it you could get values 'injected' through HTTP GET or POST. By using the superglobal arrays $_GET[], $_POST[] etc there is never any question as to where the values have come from.

I hadn't actually noticed the recheck bug on my webserver because i've never hit the 'Recheck em All' button ;) All my rechecks are automated through cron :D

27 Sep 11, 2005 21:56

oh, also, the nice 'b2evo' way of doing what Lunatic did to fix the problem is to add

param( 'recheck', 'integer' );

beneath param( 'keyword', 'string' );

param() is a b2evo method that checks the superglobal arrays for you so you don't need to worry how it was passed to the page and it registers it for you as well :)

28 Sep 11, 2005 21:59

Cool. Man oh man - I gotta go back and correct these issues wherever I can. Hey do me a favor: troubleshoot my not-yet-posted-but-coming-soon whitelist hack for similar issues. It's hard for me to test myself since my server lets me get away with something that causes problems for others.

29 Apr 04, 2006 23:48

I would rather impliment this hack than update and then hack. Is there anyway the full details can be posted, just for us, well... lazy butts?

Form is loading...