Advertisement:

Author Topic: Stop Spammer  (Read 678254 times)

Offline M-DVD

  • SMF Hero
  • ******
  • Posts: 1,650
  • Gender: Male
  • Step by step will update the mods to SMF 2RC2
Stop Spammer
« on: December 31, 2008, 07:31:43 AM »
Link to Mod

MOD Stop Spammer v2.3.9
==================


  • Authors:
M-DVD and snoopy_virtual
  • Version:
2.3.9
  • Release:
9th January 2010
  • Languages:



  • Compatible With:
SMF 1.1.1 - 1.1.21
SMF 2 RC4 - 2.0.10
Comment this Mod
M-DVD's MODs
Snoopy's MODs
Images
         
Contact Snoopy via Skype
I don't mind at all answering PMs,
but really like more to talk,
and using a microphone can sort
any problem a lot faster.
Help support Snoopy's MODs

IMPORTANT:
This MOD works better when used
together with MOD httpBL


(Before you ask for a new feature or report a bug
check if it's already in the cue waiting to be done)


Features:

  • With this MOD you can Block the Registry of Spammers in your Forum.

  • When registering a user, it will compare their data (nickname, IP and mail) with the
    "Stop Forum Spam" DB. If it match any data, then the user is leaved inactive 'Waiting for Approval'.
    Admin > Members > Awaiting Approval

  • You can leave the 'Inmediate Registration' enabled for all users (so you don't disturb them),
    but if a Spammer is detected it will apply 'Register Approval' automatically.

  • Also you can check all data of many members (already registred) automatically with
    a simple click, selecting them in the list...
    Admin > Members > View All Members

  • And report new Spammers and increase the DB, with a simple click.

  • It keeps a record of the number of all Spammers Blocked to date,
    you can enable and disable this MOD and more

Thanks to 'Stop Forum Spam' for your DB and APIs.

Thanks to WhatsTheRent and KahneFan for idea.
 
==========================

Quote
Languages (normal & utf-8)
Translation completed:
  • English
  • English_british
  • Spanish_es
  • Spanish_latin

Missing 7 lines:
Missing 9 lines:
   
Quote
Legend
  • Included in MOD package
  • Included in language_full.zip and translation complete
  • Included in language_full.zip but translation incomplete

Code: [Select]
$txt['stopspammer_error'] = 'Error with Anti SPAM DB. Connection Failed.<br />
Please try again later, or Contact with the WebMaster';
$txt['stopspammer_count'] = 'Spammers blocked up until today';
$txt['stopspammer_title'] = 'Search more info in `Stop Forum Spam`';

$txt['stopspammer_enable'] = 'Enable/Disable MOD Stop Spammer';
$txt['stopspammer_show01'] = 'Show Link "More Info" for All Members';
$txt['stopspammer_show01_sub'] = 'You can check any member at any time with one simple click';

$txt['stopspammer_faildb'] = 'If the Connection Fail with Anti SPAM DB...';
$txt['stopspammer_fail01'] = 'Show Error and Stop Registration';
$txt['stopspammer_fail02'] = 'Allow Immediate Registration';
$txt['stopspammer_fail03'] = 'Member Approval and show yellow icon to check later';
$txt['stopspammer_faildb1_sub'] = 'Your host can make remote connection with the DB';
$txt['stopspammer_faildb2_sub'] = 'Your host couldn\'t make connection with the DB. Try again later.<br />
If this error continues see Support Topic and search ';
$txt['stopspammer_not_translate'] = '<a href="http://www.simplemachines.org/community/index.php?topic=283309.msg1920848#post_issues"><span class="error"><b>Known Issues</b></span></a>';

$txt['stopspammer_leyd01'] = 'Not Spammer: This data wasn\'t in a DB. But you can check';
$txt['stopspammer_leyd02'] = 'Suspect: This member couldn\'t be checked. Check now';
$txt['stopspammer_leyd03'] = 'Spammer: See more info of activity of this spammer';

$txt['stopspammer_profilecheck'] = 'Check this member';
$txt['stopspammer_limitexceded'] = 'You have exceded the check limit (5000 API queries per day).<br />
You should wait until tomorrow to check again.';

$txt['in_stop_forum_spam'] = 'In Stop Forum Spam Web:';
$txt['spammers_checks'] = 'Check these Members';
$txt['spammers_report'] = 'Report these Members';
$txt['confirm_spammers_checks'] = 'Are you sure you want to check the selected members?';
$txt['confirm_spammers_report'] = 'Are you sure you want to report the selected members?\n\n
Think that when you report a member to SFS they are marked as spammer all over the world\n
and they won\\\'t be able to use any of the forums connected to SFS around the world.\n\n
Do it only if you are completely sure they are spammers and if by any chance you make a mistake\n
tell as soon as possible the mod\\\'s creator to correct the mistake inside the SFS database.';

$txt['stopspammer_api_key'] = 'Your API key';

$txt['stopspammer_check_name'] = 'Check their username';
$txt['stopspammer_check_mail'] = 'Check their email';
$txt['stopspammer_check_ip'] = 'Check their IP';
$txt['stopspammer_check_sub2'] = 'By default, every time you check a member with MOD Stop Spammer
it will check their username, email and IP. If you are getting too many false positives because of
their usernames you can turn that option off. We wouldn\'t recomend you to turn off the another 2
options (to check their email and IP) unless you know what you are doing.';

// Changed from 2.3.8 to 2.3.9
$txt['stopspammer_check_sub1'] = 'If MOD Stop Spammer is enabled, every time we check a member:';
$txt['stopspammer_api_key_sub'] = 'If you want to use your own API key you must go first to
<a href="http://www.stopforumspam.com/signup" target="_blank">www.stopforumspam.com</a> to sign up
for one and write it here. If you haven\'t got one you cannot report spammers with this mod.<br /><br />
If you need help with this configuration or with anything else about Mod Stop Spammer, apart from
the support forums, you can also ask for online help. If you have already installed Mod httpBL you
can see how to ask for online help going to Admin => MOD httpBL => Help. If you haven\'t got it you can
<a href="http://www.snoopyvirtualstudio.com/contact.php?language=english" target="_blank">see more info here</a>.';

// New in version 2.3.9
$txt['stopspammer_settings'] = 'MOD Stop Spammer settings';
$txt['stopspammer_enable_sub'] = 'With this check-box checked the mod is ON. With the check-box
unchecked the mod is OFF.';
$txt['stopspammer_error_no_api_key'] = 'You cannot report a spammer without an API key from www.stopforumspam.com
<br /><br />You need to register on their site first, ask them for an API key and then navigate inside your forum to:
<br />Admin => Members => Registration => Settings<br />Scroll down to Stop Spammer settings,
write your API key there and save your settings.';
$txt['stopspammer_no_connect_1'] = 'Mod Stop Spammer is ON but there is no connection just now with Stop Forum Spam.
Please try later.';
$txt['stopspammer_no_connect_2'] = 'If the problem persists ask for help in the
<a href="http://www.snoopyvirtualstudio.com/foro/index.php?board=31.0" target="_blank">official support forum</a>.';
$txt['stopspammer_new_version_1'] = 'Mod Stop Spammer is ON but it is not up-to-date.';
$txt['stopspammer_new_version_2'] = 'There is a new version of this mod. The version you have is: ';
$txt['stopspammer_new_version_3'] = '<a href="http://www.snoopyvirtualstudio.com/foro/index.php?board=31.0" target="_blank">
Please update it here whenever you can</a> to the new version: ';
$txt['stopspammer_all_ok'] = 'Mod Stop Spammer is ON, it is up-to-date and the connection with Stop Forum Spam is perfect.';
$txt['stopspammer_is_off'] = 'Mod Stop Spammer is OFF.';

Anybody doing new translations or finishing incomplete ones is welcomed here

==========================

Características:

  • Con este MOD tu puedes Bloquear el Registro de los Spammer en tu Foro

  • Al registrarse un Usuario se comparan sus datos (nick, IP y mail) con la DB de la web
    'Stop Forum Spam' y si coincide algún dato, el usuario quedará inactivo 'Esperando Aprobación'.

  • Tu puedes tener el 'Registro Inmediato' activado para todos los usuarios (y no causarles
    molestias), pero a los Spammer que se detecten se les aplicará 'Aprobación del Registro'.

  • También puedes revisar todos los datos de muchos miembros (que ya están registrados)
    automáticamente con un simple click, seleccionándolos en la lista.

  • Y también puedes reportar nuevos Spammers y aumentar la DB, con un simple click.

  • También, lleva un registro numérico de todos los Spammer bloqueados hasta la fecha,
    activar y desactivar el MOD y Más

Fin.

==========================

Change Log:

Quote


Version 2.3.9 - 9th January 2011
  *Changes in the API key. From this version the API key is ONLY needed
to report spammers, NOT to check them
  !Fixed the bug about once a member is marked "yellow" always stay yellow,
reported by tm82 here with the solution proposed by himself
  +Added the buttons to "Check" and "Report" members also to the pages
"Waiting for approval" and "Waiting for activation"
  +Added a system to check if the mod is ON, if it is up-to-date and if the
connexion with Stop Forum Spam's DB is OK
  *Changed 2 lines and added 10 new lines in language files
  ?Uninstall old version and install new one
  ?No need to edit manually any template file unless you are not using
the default Theme and you have the files Register.template.php or
ManageMembers.template.php inside the folder of the particular
Theme you are using


Version 2.3.8 - 23th December 2010
  *Changes in the Code to make the mod compatible with 2.0 RC4
(thanks to busterone here)
  !Fixed the bug about "Undefined index: types"
(thanks to gizmo71 here)
  -Eliminated completely the default API key as requested by
Stop Forum Spam's admin (see here)
  ?Unistall & Update. It's not necessary to re-edit the template files
unless you have in your template folder the file
ManageMembers.template.php or Register.template.php


Version 2.3.7 - 7th February 2010
  *Changes in the Code to make the mod compatible with 1.1.11 and 2.0 RC2
  *Some minor changes in english language files
  +You can use now your own API key if you want
  +You can now decide if the mod will check or not the username, email and IP
  +7 new strings in language files
  !Fixed the yellow bug
  !Fixed issue with utf-8 spanish language files
  !Fixed some minor bugs
  ?Unistall & Update. It's not necessary to re-edit the template files
unless you have in your template folder the file
ManageMembers.template.php or Register.template.php


Version 2.3 - 27th September 2009
  *Changes in the Code
  *Regex repaired (the API XML SFS's was changed)
  *If the member is approved is showed in blue
  +You can go to check & report a member via his profile
  +If the API limit query is exceded, you will be notified
  ?Unistall & Update. It's not necessary to re-edit the template files


Version 2.2 - 13th February 2009
  !Fix issue in Registration from ACP
  ?Unistall & Update. It's not necessary to re-edit the template files


Version 2.1 - 08th February 2009
  !Fixed typo bug in the function checkreportMembers
  ?Unistall & Update. It's not necessary to re-edit the template files


Version 2.0 - 08th February 2009
  +You can enable and disable this MOD with a click
  +The MOD automatically test your host for conection remote
  +You can choose the action if the connection fails
  +Your user will have three states (blue, yellow & red)
  +You can check any data in SFS Web, with a click
  +You can check all data of many members with a click
  +You can report many members with a simple click
  !Fixed issue with membername and error in conection
  ?Unistall & Update. It's not necessary to re-edit the template files


Version 1.0 - 31th December 2008
  oInitial release
  oCan Block the Registry of Spammer in your Forum
  oWill be checked their data (nickname, IP and mail) in SFS DB
  oIf match any data, the user is inactive Waiting for Approval
  oYou can set enabled the Inmediate Registration with this MOD
  oAlso, it keeps a record number of all Spammers Blocked
  oCompatible with SMF 1.1.X & SMF 2b-RC


Quote
Legend
oFeature
*Change
+Added
-Eliminated
!Bug Fixed
?How to Update


==========================

Road Map:

Quote
Things to do in the near future: (9th January 2010)

   *Update the pictures in the mod page.
 
   +Add spammers data to the cache.
 
   !Try to sort the "false positive" problem mixing
the suspicious list solution (see reply #580 here)
with SiL's solution. (see reply #324 here)
and Robert A. Rosenberg's solution. (see reply #584 here).
If I can mix all that with the solution we already have.
 
   !Sort the bug about the members count reported also many times.
The main page is still telling you there are members waiting for approval
even after you have approved or deleted all of them.
 
   !Sort the bug with the "Undefined index: stopspammer_profilecheck"
(reported by Vincent Volmer here).
 
   *Modify the FAQ written by M-DVD 2 years ago.
Delete obsolete ones and add new ones.
 
   *Find a way to complete the incomplete translations.
 
Quote
Legend
*Feature to be Changed
+Feature to be Added
-Feature to be Eliminated
!Bug to be Fixed
« Last Edit: October 14, 2009, 10:48:54 PM by M-DVD »

Offline uberjon

  • Jr. Member
  • **
  • Posts: 348
  • Gender: Male
  • i tar and feather bad hosts on SMF's hosting board
Re: Stop Spammer
« Reply #1 on: December 31, 2008, 08:10:21 AM »
are there any adjustable settings? i don't see any in the acp? looks great on paper so far. hope its as good in reality!

Offline ѕησω

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 3,427
  • Gender: Male
  • Nisi credideritis, non intelligetis.
    • wade.poulsen93 on Facebook
    • acans on GitHub
    • https://www.linkedin.com/profile/view?id=145186638 on LinkedIn
    • @imacans on Twitter
    • Acans
Re: Stop Spammer
« Reply #2 on: December 31, 2008, 09:53:43 AM »
This will work with keeping auto's that post links and porn and such right?, or does one need to be banned first
"The Book of Arantor, 17:3-5
  And I said unto him, thy database query shalt always be sent by the messenger of $smcFunc
  And $smcFunc shall protect you against injections and evil
  And so it came to pass that mysql_query was declared deprecated and even though he says he is not dead yet, the time was soon to come to pass when mysql_query shall be gone and no more."

Offline uberjon

  • Jr. Member
  • **
  • Posts: 348
  • Gender: Male
  • i tar and feather bad hosts on SMF's hosting board
Re: Stop Spammer
« Reply #3 on: December 31, 2008, 10:23:43 AM »
This will work with keeping auto's that post links and porn and such right?, or does one need to be banned first

if i add a bot to the SFS (stop forum spam) database, and the bot trys to register on your site it will detect it as a bot ;)

Offline WhatsTheRent

  • Semi-Newbie
  • *
  • Posts: 31
    • WhatsTheRent.com
Re: Stop Spammer
« Reply #4 on: January 01, 2009, 03:47:29 PM »
Thanks for doing this, I think it will be very helpful is stopping spam.  That database is actually quite large and gets updated often

Is there a master on/off switch for this app somewhere in the settings?

thanks again

Offline M-DVD

  • SMF Hero
  • ******
  • Posts: 1,650
  • Gender: Male
  • Step by step will update the mods to SMF 2RC2
Re: Stop Spammer
« Reply #5 on: January 02, 2009, 10:15:18 PM »
are there any adjustable settings? i don't see any in the acp? looks great on paper so far. hope its as good in reality!

No, not yet. Installed and working.

Maybe, then add an option to enable and disable.

This will work with keeping auto's that post links and porn and such right?, or does one need to be banned first

If you already have registered spammer, then not, you have to manually banned or delete.

The MOD, blocks Spammer at the time they are register.

Once blocked you can check if it was a false positive, you can left blocked, reject, delete or ban.

It also has a counter of all the blockade that has made the MOD.

if i add a bot to the SFS (stop forum spam) database, and the bot trys to register on your site it will detect it as a bot ;)

Yes, thanks :)

In the DB of SFS there are many Spammer reported that serve everyone. And everyone can contribute reporting more and more spammer and increase the DB.

Thanks for doing this, I think it will be very helpful is stopping spam.  That database is actually quite large and gets updated often

Is there a master on/off switch for this app somewhere in the settings?

thanks again

Thank you. In the next version, I will add this function.

If have more ideas for improving the mod and add more features, then I can do one update with all the latest features.


Offline edi67

  • SMF Hero
  • ******
  • Posts: 1,532
  • Gender: Male
  • Italian Supporter
    • CrazyZone
Re: Stop Spammer
« Reply #6 on: January 04, 2009, 05:31:52 AM »
let me try
CrazyZone - My SMF Forum


From the difficult the hardening of the man you can see

Offline edi67

  • SMF Hero
  • ******
  • Posts: 1,532
  • Gender: Male
  • Italian Supporter
    • CrazyZone
Re: Stop Spammer
« Reply #7 on: January 04, 2009, 05:51:40 AM »
weel i noticed one problem , installed and all work ok but here is one problem for over 1 hour i trying to register as new user in my forum using data of spammer (email or name of spammer registered in Stop forum Spam) and for all this time i cannot register cause my registration form give me always his error:

Error with DB Anti SPAM. Connection Failed.

Well as i see nobody can register in my forum when MOD cannot connect to DB of stop frm spam, and this happen a lot o time... so i need to unistall it for make my users register without problem.
Some solution for have one connectionmore stable ?
 
CrazyZone - My SMF Forum


From the difficult the hardening of the man you can see

Offline M-DVD

  • SMF Hero
  • ******
  • Posts: 1,650
  • Gender: Male
  • Step by step will update the mods to SMF 2RC2
Re: Stop Spammer
« Reply #8 on: January 04, 2009, 12:41:03 PM »
weel i noticed one problem , installed and all work ok but here is one problem for over 1 hour i trying to register as new user in my forum using data of spammer (email or name of spammer registered in Stop forum Spam) and for all this time i cannot register cause my registration form give me always his error:

Error with DB Anti SPAM. Connection Failed.

Well as i see nobody can register in my forum when MOD cannot connect to DB of stop frm spam, and this happen a lot o time... so i need to unistall it for make my users register without problem.
Some solution for have one connectionmore stable ?

Hi.

Can be three cases:

1.- The StopForumSpam website was down at that time. (*)

2.- The SFS website has no range up to your site host. (*)

(*) sorry if my translation isn't a sentence technically correct.

3 .- Your host has disabled fsockopen().

For this case you can try this mod. cURL fetch_web_data

Offline WVHunter

  • Semi-Newbie
  • *
  • Posts: 28
Re: Stop Spammer
« Reply #9 on: January 27, 2009, 09:58:52 PM »
I have the same issue as reported by someone else.

I have a person trying to register.  I have exchanged emails with him several times and walked him through the steps of registering.  Telling him to make sure he types the letters in the box as exact (Spam Bot Mod) and to answer the question that is asked (I believe this is your Mod - Stop Spammer).

He is reporting the following:

An Error Has Occurred! Error with DB Anti SPAM. Connection Failed.

He has tried twice to register and cannot.

Does your Mod work with SMF 1.1.7 and the Mercury Theme?

I am currenlty trying your cURL fix, but don't know if I need it or not.

Thanks in advance.

Offline M-DVD

  • SMF Hero
  • ******
  • Posts: 1,650
  • Gender: Male
  • Step by step will update the mods to SMF 2RC2
Re: Stop Spammer
« Reply #10 on: January 27, 2009, 10:33:36 PM »
Yes, it works with SMF 1.1.X, and the theme shouldn't influence the register.
   
Only happens to that person? Have you tried registering yourself?

Try using the MOD aldo's. I think that your host server haven't enabled fsockopen function, then, you can try using cURL.

Otherwise should be the other cases.

Tell me the results.

Offline WVHunter

  • Semi-Newbie
  • *
  • Posts: 28
Re: Stop Spammer
« Reply #11 on: January 27, 2009, 11:46:06 PM »
Yes, it works with SMF 1.1.X, and the theme shouldn't influence the register.
   
Only happens to that person? Have you tried registering yourself?

As far as I know with that one person, yes.  Yes I registerd my self with another identity and email.  It worked for me once, but after deleting that account I tried again since this other person told me of his problem.  Now I get registered buy am not getting my activation code email.  Tried several times now and nothing.

Quote
Try using the MOD aldo's. I think that your host server haven't enabled fsockopen function, then, you can try using cURL.

I have downloaded and installed this MOD as well and still nothing.  I get registered and not getting my activation code email.

Activation code email is enabled in registration setup.

Offline M-DVD

  • SMF Hero
  • ******
  • Posts: 1,650
  • Gender: Male
  • Step by step will update the mods to SMF 2RC2
Re: Stop Spammer
« Reply #12 on: January 28, 2009, 08:26:57 PM »
Ok, let me sort the ideas, i think i understood.

1.- Installing the MOD.

2.- Making the test, you registered pretending to be a normal user (in action=register) (not from the administration panel). And you registered with no problems.

3.- Later, a user will notify you the problem.

What was the problem? Would not connect with the DB? not had the activation code?.

¿I understood right?

Offline HR

  • Jr. Member
  • **
  • Posts: 321
  • Gender: Male
  • There is only ONE 'Reality!
    • http://only-harshreality.com/forums/
Re: Stop Spammer
« Reply #13 on: February 04, 2009, 09:46:31 AM »
Any idea as t owhen you'll be putting in the 'off switch'?
I can explain this as simply as possible.. If I do it & implement I guarantee it.
 If I do it and you implement it its a crap shoot.

Offline M-DVD

  • SMF Hero
  • ******
  • Posts: 1,650
  • Gender: Male
  • Step by step will update the mods to SMF 2RC2
Re: Stop Spammer
« Reply #14 on: February 04, 2009, 07:24:05 PM »
Any idea as t owhen you'll be putting in the 'off switch'?


Yes, in this weeks, I will release a new version that will have some improvements, and also it function. :)

Offline snoopy_virtual

  • Sophist Member
  • *****
  • Posts: 1,155
  • Gender: Male
    • jcredondosnoopy on Facebook
    • Snoopy Virtual Studio
Re: Stop Spammer
« Reply #15 on: February 06, 2009, 01:40:10 AM »
Hi M-DVD

First of all thanks for your work.

I was having a lot of work fighting spammers until I found www.stopforumspam.com because I administer 10 different forums.

My first idea when I found them was to do a mod myself for SMF, but then I found your mod already done, so if you don't mind I am going to use your mod instead and try to add a few things if I can.

The fist thing I have found is a small mistake in your function chekDBSpammer.

I found it because I had in one of the forums I administer 600 members before I installed your mod.

In this particular forum 3 months ago there were only 30 members (it was open 2 years ago) and I was sure it was impossible all these 570 new members were all honest ones, so I started checking one by one in www.stopforumspam.com

That's a lot of ctrl+c ctrl+v so I decided to add to your mod a button to check all the members already in the forum in just one "click".
But it didn't work. I was getting all the time the same message some people are reporting here:

An Error Has Occurred! Error with DB Anti SPAM. Connection Failed.

Then I did instead a button to check just one member and everything was going right until I arrived to a particular member that was giving me the same error message again all the time.

Then I realized the difference. This member had chosen a username with a white space in the middle.

For example if you check username=pericolospalotes or username=perico_los_palotes you get no error, but if you check username=perico los palotes you get that error.

Then I went to www.stopforumspam.com and try to check manually that username and found out that their search script had changed it to username=perico+los+palotes

So the solution is obvious:

I just added the line:

Code: [Select]
$check_name = str_replace(" ", "+", $check_name);

Just at the beginning of the function, after the line:

Code: [Select]
global $sourcedir;

And now I have no problem with the buttons and I can check all the 600 members in less than 2 seconds. (By the way, 550 of them were actually spammers. I knew it.)

May be the people that were getting the same error were checking also usernames with white space in the middle. If this is the case it will be sorted just adding that line.

If you want to add to your mod the button to check all the members in the forum, the code I have been using is:

Code: [Select]
$result = db_query("
  SELECT ID_MEMBER, memberName, emailAddress, memberIP
  FROM {$db_prefix}members
", __FILE__, __LINE__);

while ($row = mysql_fetch_assoc($result))
{
  $members[] = array(
    'id' => $row['ID_MEMBER'],
    'username' => $row['memberName'],
    'email' => $row['emailAddress'],
    'ip' => $row['memberIP']
  );
}
mysql_free_result($result);

foreach ($members as $member)
{
  $userid = $member['id'];
  $grado_spam = chekDBSpammer($member['ip'], $member['username'], $member['email']);
  if ($grado_spam != 0)
  {
    db_query("
      UPDATE {$db_prefix}members
      SET is_spammer = $grado_spam
      WHERE ID_MEMBER = $userid
    ", __FILE__, __LINE__);
  }
}

Anyway it's not finished, it has a few mistakes.

For example it set is_spammer = 2 to honest members with common names like "george" or "ruth", so I will need to add another button to tell the script "this member is not spammer" (I have been doing it today changing it manually inside the database, as they were just a few of them) and I will need to finish the HTML to put it properly inside the template (I have been using it in a separate page just linked to the forum via SSI) but it's a start.

Anyway I am more interested in develop a couple of buttons properly done inside the profile page (in admin mode only, of course). One for "check this user to see if it's a spambot" (if I am suspicious with somebody)  and another one for "Submit this member's details to stopforumspam database" (before I delete a spammer).

If I have some free time and I do them before you do them yourself I will send you the code.

And again congratulations for your work.

I really like the way you write code.  ;)
El verdadero sabio es aquel que lo ve todo, lo estudia todo, lo analiza todo y molesta poco.
A true wise man is he who sees everything, studies everything, analyses everything and hardly ever annoys.

Offline M-DVD

  • SMF Hero
  • ******
  • Posts: 1,650
  • Gender: Male
  • Step by step will update the mods to SMF 2RC2
Re: Stop Spammer
« Reply #16 on: February 06, 2009, 08:24:23 AM »
Hi M-DVD

First of all thanks for your work.

Thank you.

In this particular forum 3 months ago there were only 30 members (it was open 2 years ago) and I was sure it was impossible all these 570 new members were all honest ones, so I started checking one by one in www.stopforumspam.com

That's a lot of ctrl+c ctrl+v so I decided to add to your mod a button to check all the members already in the forum in just one "click".

If I understand correctly, precisely is (* similar) to one of the improvements that will bring the next version (which I don't know whether to call it version 1.1 or 2.0). :P

(*) Exactly so: "One for "check this user to see if it's a spambot" (if I am suspicious with somebody)"

But it didn't work. I was getting all the time the same message some people are reporting here:

An Error Has Occurred! Error with DB Anti SPAM. Connection Failed.

Then I realized the difference. This member had chosen a username with a white space in the middle.

For example if you check username=pericolospalotes or username=perico_los_palotes you get no error, but if you check username=perico los palotes you get that error.

Then I went to www.stopforumspam.com and try to check manually that username and found out that their search script had changed it to username=perico+los+palotes

So the solution is obvious:

I just added the line:

Code: [Select]
$check_name = str_replace(" ", "+", $check_name);

Just at the beginning of the function, after the line:

Code: [Select]
global $sourcedir;

Thanks, was beginning to think that the error could be in some char. A improvement would allow them to see the users with this problem (it wouldn't prevent its registration, but would give them a different "mark"). But you have saved me a lot of work.   :D


And now I have no problem with the buttons and I can check all the 600 members in less than 2 seconds. (By the way, 550 of them were actually spammers. I knew it.)

If you want to add to your mod the button to check all the members in the forum, the code I have been using is:

Code: [Select]
$result = db_query("
  SELECT ID_MEMBER, memberName, emailAddress, memberIP
  FROM {$db_prefix}members
", __FILE__, __LINE__);

while ($row = mysql_fetch_assoc($result))
{
  $members[] = array(
    'id' => $row['ID_MEMBER'],
    'username' => $row['memberName'],
    'email' => $row['emailAddress'],
    'ip' => $row['memberIP']
  );
}
mysql_free_result($result);

foreach ($members as $member)
{
  $userid = $member['id'];
  $grado_spam = chekDBSpammer($member['ip'], $member['username'], $member['email']);
  if ($grado_spam != 0)
  {
    db_query("
      UPDATE {$db_prefix}members
      SET is_spammer = $grado_spam
      WHERE ID_MEMBER = $userid
    ", __FILE__, __LINE__);
  }
}

Anyway it's not finished, it has a few mistakes.

For example it set is_spammer = 2 to honest members with common names like "george" or "ruth", so I will need to add another button to tell the script "this member is not spammer" (I have been doing it today changing it manually inside the database, as they were just a few of them) and I will need to finish the HTML to put it properly inside the template (I have been using it in a separate page just linked to the forum via SSI) but it's a start.

Wow, this idea is very good, ¿i can add this feature in the MOD?  :P

If I have some free time and I do them before you do them yourself I will send you the code.

And again congratulations for your work.

I really like the way you write code.  ;)

The updating I have made already, I expected test it today or tomorrow. (If I add your code, maybe, it will take tomorrow or sunday).

Thank you too :D

Offline snoopy_virtual

  • Sophist Member
  • *****
  • Posts: 1,155
  • Gender: Male
    • jcredondosnoopy on Facebook
    • Snoopy Virtual Studio
Re: Stop Spammer
« Reply #17 on: February 07, 2009, 06:28:53 AM »
You can use and modify any part of my code you want. No problem at all.

I think that free code is always better (that's why I use Linux)  :)

Just another small bug. Well, it's not a different one, it's the same one really but in your function sprintfspamer:

The variable $value can be either the username, the email, etc and you send a query to stopforumspam with that value:

Code: [Select]
<a href="http://www.stopforumspam.com/search?q=' . $value . '" target="_blank">

If $value is the username and it has white space, we have the same problem as before, so I would change the function like this:

Code: [Select]
function sprintfspamer($value, $url, $is_spamer, $type)
{
global $txt, $settings;

$value2 = str_replace(" ", "+", $value);
$format1 = ($is_spamer && $is_spamer >> ($type - 1) & 1)
? '<a href="http://www.stopforumspam.com/search?q=' . $value2 . '" target="_blank"><img src="' . $settings['images_url'] . '/icons/spammer.gif" alt="[' . $txt['manage_search'] . ']" title="' . $txt['stopspammer_title'] . '" style="vertical-align: middle" /></a>'
: '';
$format2 = $is_spamer ? array('<span class="error">', '</span>') : array('', '');

return $format1 . '<a href="'. $url . '">' . implode($value, $format2) . '</a>';
}

Note that I have changed $value with $value2 only in the query, not inside the last line. This way you send the query without white space but you leave untouched the name when you write it on the screen.



By the way, I think the way you use the binary numbers in the line:

Code: [Select]
$format1 = ($is_spamer && $is_spamer >> ($type - 1) & 1)

Is just brilliant. I really love it.

Do you know that in this world there are 10 kind of people?

  - Those who understand binary numbers.

  - And those who don't.

 8)



Another idea I was just starting to develop is a button to submit the details of any spammer to stopforumspam's database.

The first thing you will need is a link (somewhere in the admin section) to stopforumspam to request an API key, because to be allowed to submit spammers details to stopforumspam's database you need to get one first.

The link need to point to:

http://www.stopforumspam.com/signup

And you will need an option to save the API key inside the settings table in our database to have it later as the variable $modSettings['api_key']

You could also add another value to the members database (apart from the value is_spamer to see if the member is a bad guy) another one to see if the details had been already submited (just a "yes" or "no").

Then inside the profile page of every member Profile.template.php you can add a conditional:

If (this guy is a spammer && the details hadn't been submitted yet)
{
    if (we already have an API key)
    {
        echo a button to submit details
    }
    else
    {
        echo the link to get an API key and the option to save it in the database
    }
}

The button could be a link to $scripturl . '?action=profile2; with a new subaction sa=submitSpammer

Then inside Sources/Profile.php we put a new function for this new subaction to actually submit the details.

There are a couple of ideas inside stopforumspam to do that.

I like for example this one:

Code: [Select]
function PostToHost($host, $path, $data_to_send) {
    $fp = fsockopen($host,80);
    fputs($fp, "POST $path HTTP/1.1\n" );
    fputs($fp, "Host: $host\n" );
    fputs($fp, "Content-type: application/x-www-form-urlencoded\n" );
    fputs($fp, "Content-length: ".strlen($data_to_send)."\n" );
    fputs($fp, "Connection: close\n\n" );
    fputs($fp, $data_to_send);
    fclose($fp);
}

PostToHost("www.stopforumspam.com", "/post.php", "username=" . $member['username'] . "&ip_addr=" . $member['ip'] . "&email=" . $member['email'] . "&api_key=" . $modSettings['api_key']);

The only thing I don't know is what will happen if the username has white space.

Maybe we will need to change it to "+" or to "%20" before submit it. I don't know.

I will try it and I will tell you.
« Last Edit: February 07, 2009, 06:47:41 AM by snoopy_virtual »
El verdadero sabio es aquel que lo ve todo, lo estudia todo, lo analiza todo y molesta poco.
A true wise man is he who sees everything, studies everything, analyses everything and hardly ever annoys.

Offline M-DVD

  • SMF Hero
  • ******
  • Posts: 1,650
  • Gender: Male
  • Step by step will update the mods to SMF 2RC2
Re: Stop Spammer
« Reply #18 on: February 07, 2009, 09:10:09 AM »
You can use and modify any part of my code you want. No problem at all.

I think that free code is always better (that's why I use Linux)  :)

Thanks, I will add this feature.  :D

I am not yet decided whether to put a button to check all members, or (using the list) to review only selected members.  :-\

Just another small bug. Well, it's not a different one, it's the same one really but in your function sprintfspamer:

The variable $value can be either the username, the email, etc and you send a query to stopforumspam with that value:

Code: [Select]
<a href="http://www.stopforumspam.com/search?q=' . $value . '" target="_blank">

If $value is the username and it has white space, we have the same problem as before, so I would change the function like this:

Thanks again. This function had many changes to adapt to the new version v1.1, but hadn't corrected this.  :-[


By the way, I think the way you use the binary numbers in the line:

Code: [Select]
$format1 = ($is_spamer && $is_spamer >> ($type - 1) & 1)

Is just brilliant. I really love it.

Do you know that in this world there are 10 kind of people?

  - Those who understand binary numbers.

  - And those who don't.

 8)

Yes XD.

This line also changes.

Code: [Select]
$suma += ('yes' == $q_is_spammer[2][$key]) * ('ip' == $value ? 1 : ('username' == $value ? 2 : 4));
Now:

Code: [Select]
$suma += ('yes' == $q_is_spammer[2][$key]) << ('ip' == $value ? 0 : ('username' == $value ? 1 : 2));
The binary operations better and faster than arithmetic operations :P

Another idea I was just starting to develop is a button to submit the details of any spammer to stopforumspam's database.

The first thing you will need is a link (somewhere in the admin section) to stopforumspam to request an API key, because to be allowed to submit spammers details to stopforumspam's database you need to get one first.
--
The only thing I don't know is what will happen if the username has white space.

Maybe we will need to change it to "+" or to "%20" before submit it. I don't know.

I will try it and I will tell you.

I had intended to include the APIkey, but, It is a good idea?, while i decide this, i think leave this feature for another version, although it would be better in a single release.

--

Good text in your signature  8)
« Last Edit: February 07, 2009, 09:13:01 AM by M-DVD »

Offline snoopy_virtual

  • Sophist Member
  • *****
  • Posts: 1,155
  • Gender: Male
    • jcredondosnoopy on Facebook
    • Snoopy Virtual Studio
Re: Stop Spammer
« Reply #19 on: February 07, 2009, 09:58:22 AM »

I am not yet decided whether to put a button to check all members, or (using the list) to review only selected members.  :-\


Maybe better only with selected members, because anyway if you try to check too many in one go sometimes the server reach the time execution limit and the script just stop working.



This line also changes.

Code: [Select]
$suma += ('yes' == $q_is_spammer[2][$key]) * ('ip' == $value ? 1 : ('username' == $value ? 2 : 4));
Now:

Code: [Select]
$suma += ('yes' == $q_is_spammer[2][$key]) << ('ip' == $value ? 0 : ('username' == $value ? 1 : 2));
The binary operations better and faster than arithmetic operations :P


I was going to tell you that as well and forgot it.

Better like that.


I had intended to include the APIkey, but, It is a good idea?, while i decide this, i think leave this feature for another version, although it would be better in a single release.


I think it's a good idea, but of course it's up to you. It's not a big deal to send them manually, but the problem is that I am too lazy and always prefer to have as much as possible with just one click.  8)

I will wait anyway to see your new version to see what options you add and then I will try it to see if I still miss anything.


Good text in your signature  8)


I don't remember where I got it from, but it's because I don't like the people who talk when they have nothing important to say.  ;)

(For the english people, the text in my signature means: "The true wise man is the one who see a lot, study a lot, analyse a lot and disturb very little")
El verdadero sabio es aquel que lo ve todo, lo estudia todo, lo analiza todo y molesta poco.
A true wise man is he who sees everything, studies everything, analyses everything and hardly ever annoys.