Adware, malware, spyware, hijacker discussion and information

[Gain Knowledge]  [Install Prevention]  [Maintain Security]  [Spyware Removal Help]


It is currently Fri Sep 03, 2010 7:59 am

All times are UTC - 7 hours




Post new topic Reply to topic  [ 19 posts ] 
Author Message
 Post subject: [CODE] Integrating the spam filter into phpBB2
PostPosted: Fri Nov 28, 2008 2:49 am 
Offline
Site Admin
Site Admin
User avatar

Joined: Sun May 15, 2005 12:42 pm
Posts: 3491
Location: Newcastle, UK
Open /includes/usercp_register.php

Find:

Code:
$error = FALSE;


Replace with:

Code:
$error = FALSE;

/// BEGIN SPAM MOD
$username = $HTTP_POST_VARS['username'];
$email = $HTTP_POST_VARS['email'];
$ip = ( !empty($HTTP_SERVER_VARS['REMOTE_ADDR']) ) ? $HTTP_SERVER_VARS['REMOTE_ADDR'] : ( ( !empty($HTTP_ENV_VARS['REMOTE_ADDR']) ) ? $HTTP_ENV_VARS['REMOTE_ADDR'] : getenv('REMOTE_ADDR') );
$fspamcheck = file_get_contents('http://temerc.com/Check_Spammers/check_spammers_plain.php?name='.$username.'&email='.$email.'&ip='.$ip);
//echo $fspamcheck;
if (strpos($fspamcheck, 'TRUE') !==False) {
   // Notify admin via e-mail
   $blockedby = str_replace(' TRUE', '', $fspamcheck);
   $blockedby = str_replace(' ', ' & ', $blockedby);
   $msg = 'The following was blocked by the '.$blockedby.' filter<br><br>Username: '.$username.'<br><br>Email: '.$email.'<br><br>IP: '.$ip;
   // Change your@email.addr to the e-mail address you want e-mail reports sent to
   $to = "your@email.addr";
   $from = "nobody@".$_SERVER['SERVER_NAME'];
   $subject = "Spammer blocked by hpHosts Spam filter";
   $headers =    "MIME-Versin: 1.0\r\n" .
   "Content-type: text/html; charset=ISO-8859-1; format=flowed\r\n" .
   "Content-Transfer-Encoding: 8bit\r\n" .
   "From: " . $from . "\r\n" .
   "X-Mailer: hpHosts Spam Filter";
   mail($to, $subject, $msg, $headers);
   // Notify user
   message_die(GENERAL_MESSAGE, "Registration blocked by spam filter. Please contact the forum administrator.", '', __LINE__, __FILE__);
}
/// END SPAM MOD


If you are hosting the check_spammers function locally, then change;

http://temerc.com/Check_Spammers/check_spammers_plain.php

to;

http://YOUR_DOMAIN/PATH_TO_CHECK_SPAMMERS/check_spammers_plain.php

_________________
Regards

Steven Burn
Ur I.T. Mate Group / hpHosts
it-mate.co.uk / hosts-file.net

Keeping it FREE!


Top
 Profile Send private message  
 
 Post subject: Re: [CODE] Integrating the spam filter into phpBB2
PostPosted: Sat Aug 22, 2009 10:02 am 
Offline
User avatar

Joined: Wed Aug 19, 2009 10:03 am
Posts: 10
For use on forums in Dutch:

Find:
Code:
"Registration blocked by spam filter. Please contact the forum administrator."


Replace by:
Code:
"Registratie geweigerd door spamfilter. Zoek contact met de beheerder van dit forum."


A solution using the language files would be better. Shouldn't be to hard to find out how to make. When I've got some time left...

_________________
---
Peter
My site: Squat toilets, travel guide about France


Top
 Profile Send private message E-mail  
 
 Post subject: Re: [CODE] Integrating the spam filter into phpBB2
PostPosted: Sat Aug 22, 2009 12:22 pm 
Offline
User avatar

Joined: Wed Aug 19, 2009 10:03 am
Posts: 10
OK, I'm not a programmer, but my guess is it should reald something like this. While I can't check, can somebody tell if this is correct?

In Mod:
Find:
Code:
"Registration blocked by spam filter. Please contact the forum administrator."


Replace by:
Code:
$lang['Spam_Filter']


Open /languages/english/lang_main.php
Find:
Code:
?>

Before, add:
Code:
//Spam Mod
$lang['Spam_Filter'] = "Registration blocked by spam filter. Please contact the forum administrator.";
//End Spam Mod


Open /languages/dutch/lang_main.php
Find:
Code:
?>

Before, add:
Code:
//Spam Mod
$lang['Spam_Filter'] = "Registratie geweigerd door spamfilter. Zoek contact met de beheerder van dit forum."
//End Spam Mod


Open /languages/french/lang_main.php
Find:
Code:
?>

Before, add:
Code:
//Spam Mod
$lang['Spam_Filter'] = "Enregistrement réfusé par filtre spam. Veuillez contacter le webmestre."
//End Spam mod


And so on for all other language files you might have

_________________
---
Peter
My site: Squat toilets, travel guide about France


Top
 Profile Send private message E-mail  
 
 Post subject: Re: [CODE] Integrating the spam filter into phpBB2
PostPosted: Sat Aug 22, 2009 2:15 pm 
Offline
Site Admin
Site Admin
User avatar

Joined: Sun May 15, 2005 12:42 pm
Posts: 3491
Location: Newcastle, UK
Nice one :)

_________________
Regards

Steven Burn
Ur I.T. Mate Group / hpHosts
it-mate.co.uk / hosts-file.net

Keeping it FREE!


Top
 Profile Send private message  
 
 Post subject: Re: [CODE] Integrating the spam filter into phpBB2
PostPosted: Sun Aug 23, 2009 2:53 am 
Offline
User avatar

Joined: Wed Aug 19, 2009 10:03 am
Posts: 10
Nice, but of small use <?> . Since registering is for non registered users only, as it it has no clue to guess what language the visitor might speak, phpbb will use the standard board language (english by default). So if you have another language installed, you might as well replace the english text by another directly into the mod.
Correct me if I'm wrong...

_________________
---
Peter
My site: Squat toilets, travel guide about France


Top
 Profile Send private message E-mail  
 
 Post subject: Re: [CODE] Integrating the spam filter into phpBB2
PostPosted: Sun Aug 23, 2009 5:37 am 
Offline
Site Admin
Site Admin
User avatar

Joined: Sun May 15, 2005 12:42 pm
Posts: 3491
Location: Newcastle, UK
Sorry for taking so long.

If the board is targetted to a specific language, then straight into the mod would likely be easier, yes.

_________________
Regards

Steven Burn
Ur I.T. Mate Group / hpHosts
it-mate.co.uk / hosts-file.net

Keeping it FREE!


Top
 Profile Send private message  
 
 Post subject: Re: [CODE] Integrating the spam filter into phpBB2
PostPosted: Sat Apr 10, 2010 5:46 am 
Offline

Joined: Tue Mar 16, 2010 8:11 am
Posts: 8
I've got a slight problem. I installed it as instructed in my phpbb2 forum, and it works great, but my users can no longer click the profile button to change their own settings. It gives the blocked message. Anyone else seeing this behavior, or is it something strange with my particular system.

Even me, as the site admin, can't click the profile button anymore. If I go into the admin panel, and then edit the users like that, it brings up the correct page.


Top
 Profile Send private message E-mail  
 
 Post subject: Re: [CODE] Integrating the spam filter into phpBB2
PostPosted: Sat Apr 10, 2010 5:48 am 
Offline
Site Admin
Site Admin
User avatar

Joined: Sun May 15, 2005 12:42 pm
Posts: 3491
Location: Newcastle, UK
Can you e-mail me a copy of your current usercp_register.php file please so I can take a look?

/edit

Forgot the e-mail address;

sbst_files @ it-mate.co.uk

_________________
Regards

Steven Burn
Ur I.T. Mate Group / hpHosts
it-mate.co.uk / hosts-file.net

Keeping it FREE!


Top
 Profile Send private message  
 
 Post subject: Re: [CODE] Integrating the spam filter into phpBB2
PostPosted: Mon Apr 12, 2010 5:42 am 
Offline

Joined: Tue Mar 16, 2010 8:11 am
Posts: 8
Actually, further testing shows that its no longer working at all. Even clicking on registration just brings up a block page. I didn't change anything in the board, it used to work, and no longer does. Did something change on the temerc.com side?


Top
 Profile Send private message E-mail  
 
 Post subject: Re: [CODE] Integrating the spam filter into phpBB2
PostPosted: Mon Apr 12, 2010 6:38 am 
Offline
Site Admin
Site Admin
User avatar

Joined: Sun May 15, 2005 12:42 pm
Posts: 3491
Location: Newcastle, UK
My apologies for taking so long. Can you uncomment the following line, so we can see what's actually being returned please?

Code:
//echo $fspamcheck;


The only change has been an upgrade to the latest release.

viewtopic.php?p=3442004#p3442004

_________________
Regards

Steven Burn
Ur I.T. Mate Group / hpHosts
it-mate.co.uk / hosts-file.net

Keeping it FREE!


Top
 Profile Send private message  
 
 Post subject: Re: [CODE] Integrating the spam filter into phpBB2
PostPosted: Mon Apr 12, 2010 7:23 am 
Offline

Joined: Tue Mar 16, 2010 8:11 am
Posts: 8
A little background, the last time it was working on my board was March 16th, does that help nail down a code change?

I'm now running it locally, with the same results, using the latest code.

Fspamlist = TRUE is whats echoing back.

If I set emails to be sent, I can see that its passing what appears to be null username and email to fspamlist, along with the IP address. At least thats what the email is showing me, no username or email reported, which makes sense since this is now happening when the user clicks registration. The 'Are you 13 or older' page never shows up, it immediately goes to the block page when I have fspamlist set to true in the config.

Since I'm pretty sure I didn't change anything on my side, is it possible that the latest code update broke phpbb2?

Looking at the check_spammers_plain file, I think I see that if mail and name are null, then its gets set to nobody@example.com, and no_name_given respectively. If I type either of those into fspamlist, it looks like they come up positive. Could that be the issue with fspamlist?


Top
 Profile Send private message E-mail  
 
 Post subject: Re: [CODE] Integrating the spam filter into phpBB2
PostPosted: Mon Apr 12, 2010 7:49 am 
Offline
Site Admin
Site Admin
User avatar

Joined: Sun May 15, 2005 12:42 pm
Posts: 3491
Location: Newcastle, UK
It's certainly possible, but the changes made, were not specific to or used by, any of the boards software itself (the only change made near the 16th, was on the 21st, which disabled the undisposable check due to the services disappearing). The only thing it uses, is the return value.

The e-mails you're receiving, aren't actually data being sent to fSpamlist, but just a copy of the results (i.e. the fact it was flagged by fSpamlist).

This actually has me a little puzzled, most notably because it was occuring before you hosted it locally (this rules out a bug in the SBST itself, and points to a problem specific to phpBB2, or a conflict with another mod running on your board).

Leave it with me and I'll see if I can reproduce and identify it.

_________________
Regards

Steven Burn
Ur I.T. Mate Group / hpHosts
it-mate.co.uk / hosts-file.net

Keeping it FREE!


Top
 Profile Send private message  
 
 Post subject: Re: [CODE] Integrating the spam filter into phpBB2
PostPosted: Mon Apr 12, 2010 7:59 am 
Offline
Site Admin
Site Admin
User avatar

Joined: Sun May 15, 2005 12:42 pm
Posts: 3491
Location: Newcastle, UK
yeastmeister wrote:
Looking at the check_spammers_plain file, I think I see that if mail and name are null, then its gets set to nobody@example.com, and no_name_given respectively. If I type either of those into fspamlist, it looks like they come up positive. Could that be the issue with fspamlist?


It's certainly possible, yes, but phpBB2 should be sending the e-mail + IP at the very least. I've modified the fSpamlist API so it ignores these two if passed, could you check again and tell me if the problem persists please?

_________________
Regards

Steven Burn
Ur I.T. Mate Group / hpHosts
it-mate.co.uk / hosts-file.net

Keeping it FREE!


Top
 Profile Send private message  
 
 Post subject: Re: [CODE] Integrating the spam filter into phpBB2
PostPosted: Mon Apr 12, 2010 8:23 am 
Offline

Joined: Tue Mar 16, 2010 8:11 am
Posts: 8
Odd, Ok, now I have it working hosted locally, but the copy on your server fails. Yep, I could reproduce it by modifying the

if($mail==''){$mail='nobody@example.com';}
if($name==''){$name='no_name_given';}

lines in the fspamlist section of the check_spammers_plain.php to be other values for mail and name.

Also, just to point out, the latest build has this line
if($ip==''){$mail='1.2.3.4';}

Shouldn't that be
if($ip==''){$ip='1.2.3.4';}

Seems to be working now, at least now its not giving me the page when I try to register, or press the profile button. I haven't seen it block any spammers yet, but its looking like it is.


Top
 Profile Send private message E-mail  
 
 Post subject: Re: [CODE] Integrating the spam filter into phpBB2
PostPosted: Mon Apr 12, 2010 8:32 am 
Offline
Site Admin
Site Admin
User avatar

Joined: Sun May 15, 2005 12:42 pm
Posts: 3491
Location: Newcastle, UK
Nice one, thanks for letting me know :)

Code:
Also, just to point out, the latest build has this line
if($ip==''){$mail='1.2.3.4';}

Shouldn't that be
if($ip==''){$ip='1.2.3.4';}


It should be yes, I'll get it fixed, cheers :)

_________________
Regards

Steven Burn
Ur I.T. Mate Group / hpHosts
it-mate.co.uk / hosts-file.net

Keeping it FREE!


Top
 Profile Send private message  
 
 Post subject: Re: [CODE] Integrating the spam filter into phpBB2
PostPosted: Tue Apr 13, 2010 5:20 am 
Offline

Joined: Tue Mar 16, 2010 8:11 am
Posts: 8
Possibly one more...

functions.php

line 219, should that ~ be there?


Top
 Profile Send private message E-mail  
 
 Post subject: Re: [CODE] Integrating the spam filter into phpBB2
PostPosted: Tue Apr 13, 2010 5:24 am 
Offline
Site Admin
Site Admin
User avatar

Joined: Sun May 15, 2005 12:42 pm
Posts: 3491
Location: Newcastle, UK
Typo on my part it seems. Cheers :)

I'll get a new release out today with the 2 bug fixes :)

_________________
Regards

Steven Burn
Ur I.T. Mate Group / hpHosts
it-mate.co.uk / hosts-file.net

Keeping it FREE!


Top
 Profile Send private message  
 
 Post subject: Re: [CODE] Integrating the spam filter into phpBB2
PostPosted: Tue Apr 13, 2010 7:31 am 
Offline

Joined: Tue Mar 16, 2010 8:11 am
Posts: 8
A fix suggestion.

The way its implemented, it calls the function before they enter in their registration data. Which is fine, but it can't have a username and password because they haven't entered it yet. You pass a dummy username and email in case of the null, so every person clicking the register button gets checked with the same user name, email, and their own ip address.

What I have done is instead of passing a dummy name/email, I just pass the ip address for all 3 fields. So in check_spammers_plain.php I changed them to:

if($mail==''){$mail=$ip;}
if($name==''){$name=$ip;}

Since the ip is the only information we have at that time, it seems better than everyone having the same username. If they are a known spammer ip, we want to block them anyway.

In usercp_register.php I allso added

if ($mode == 'register')
{

to the top, and a trailing } to the end, so that it doesn't get called when they click the profile button, since they are already logged in at that point, it doesn't seem necessary.

Do you see any problems with this?


Top
 Profile Send private message E-mail  
 
 Post subject: Re: [CODE] Integrating the spam filter into phpBB2
PostPosted: Tue Apr 13, 2010 7:39 am 
Offline
Site Admin
Site Admin
User avatar

Joined: Sun May 15, 2005 12:42 pm
Posts: 3491
Location: Newcastle, UK
I don't forsee any problems with that, no :)

_________________
Regards

Steven Burn
Ur I.T. Mate Group / hpHosts
it-mate.co.uk / hosts-file.net

Keeping it FREE!


Top
 Profile Send private message  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 19 posts ] 

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 0 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:  

Who is online

Who is online In total there are 0 users online :: 0 registered, 0 hidden and 0 guests (based on users active over the past 5 minutes)
Most users ever online was 115 on Tue Jul 13, 2010 5:32 pm

Users browsing this forum: No registered users and 0 guests

New posts    No new posts    Forum locked
Powered by phpBB