Simple Machines Community Forum

Customizing SMF => Modifications and Packages => Topic started by: SleePy on March 21, 2022, 12:11:09 AM

Title: Stop Forum Spam
Post by: SleePy on March 21, 2022, 12:11:09 AM
Link to the mod (https://custom.simplemachines.org/index.php?mod=4311)

Title: Re: Stop Forum Spam
Post by: Max22 on March 21, 2022, 08:05:37 PM
I've just noticed four packages with the same name but with different extensions and size, I think it could be confusing.

sfs_packages.jpg
Title: Re: Stop Forum Spam
Post by: SleePy on March 21, 2022, 08:53:49 PM
Sorry thats a bug with the customize site.  I've fixed it manually.
Title: Re: Stop Forum Spam
Post by: Shades. on March 21, 2022, 10:47:10 PM
Quote from: SleePy on March 21, 2022, 12:11:09 AMThis customization adds support for detecting spam by using the Stop Forum Spam API.
I don't see an option to add my API#. Do we not need that anymore?

I really liked the ability to check each member individually in the 2.0 version! Any chance to bring that back, I mean add it to the 2.1 version?

Thanks,
Shades 8)
Title: Re: Stop Forum Spam
Post by: SleePy on March 22, 2022, 12:34:01 AM
You only need a API key to add submissions, not query them.

I didn't need the ability to check each member, but it could be done.
Title: Re: Stop Forum Spam
Post by: Matthias on March 24, 2022, 06:24:23 PM
I like that mod!

But I also miss the ability to check and report members in the member list.
I had that built in the old mod, but the function to check multiple members I failed for 2,1,x.
Maybe you can implement that.
Title: Re: Stop Forum Spam
Post by: Matthias on March 26, 2022, 11:09:46 AM
I have installed the mod for SMF 2.0.19. Unfortunately it does not work. It installs without error messages, but the settings are missing.
The log_sfs table was created.
In the package-info.xml is that:
<require-file name="StopForumSpam.php" destination="$sourcedir" />However, the file StopForumSpam.php does not exist in the package.
Title: Re: Stop Forum Spam
Post by: SleePy on March 26, 2022, 06:36:40 PM
I forgot to reset 2.0 after I renamed the files.  I'm working on the ability to submit and view from the profile.  I ran out of time to finish up testing, but should have something soon.  Can been seen here: https://github.com/jdarwood007/smfmod_sfs
Title: Re: Stop Forum Spam
Post by: Matthias on March 28, 2022, 11:10:28 AM
I have installed the version 1.1 for SMF 2.0.19
The installation works, but when it redirects to the settings page after installation I get a white screen and this error:
Parse error: syntax error, unexpected ':', expecting ';' or '{' in /var/www/vhosts/sntest01.schreibs.net/httpdocs/Sources/SFS.php on line 46
Title: Re: Stop Forum Spam
Post by: SleePy on March 28, 2022, 08:09:25 PM
What version of PHP do you have?
Title: Re: Stop Forum Spam
Post by: Matthias on March 29, 2022, 06:53:02 AM
Unfortunately an old
5.5.38
Title: Re: Stop Forum Spam
Post by: Kindred on March 29, 2022, 08:34:23 AM
I thought that 2.0.19 had a minimum version of 5.6 anyway.....
Title: Re: Stop Forum Spam
Post by: Doug Heffernan on March 29, 2022, 08:41:52 AM
Quote from: Kindred on March 29, 2022, 08:34:23 AMI thought that 2.0.19 had a minimum version of 5.6 anyway.....

According to the requirements page, 2.0.19 can run on a php version starting from 5.3.

https://download.simplemachines.org/requirements.php

Quote from: Matthias on March 29, 2022, 06:53:02 AMUnfortunately an old
5.5.38

I have not seen the code for this mod, but from the error message you are getting it looks like it does not support the php version that you are using.

A bit off topic, but may I ask why you are running such an older version of php? It contains many security issues, not to mention the bugs.
Title: Re: Stop Forum Spam
Post by: Matthias on March 29, 2022, 09:14:27 AM
On the server I can no longer update the PHP version. I need a new server.
Until now everything has always worked, so I said to myself, I'll do sometime...
Title: Re: Stop Forum Spam
Post by: Oldiesmann on March 29, 2022, 10:16:09 AM
Return type declarations were introduced in PHP 7, so the error is indeed due to an old version of PHP.
Title: Re: Stop Forum Spam
Post by: SleePy on March 29, 2022, 05:42:46 PM
Yea, I have return types in here and a few other PHP 7 features.  I would recommend upgrading to at least 7.1.  SMF 2.0 will work all the way up to 7.4.
Title: Re: Stop Forum Spam
Post by: Shades. on April 09, 2022, 01:18:49 AM
Under Profile>Track Stop Forum Spam "IP Address" is showing twice...

sfs.png
Title: Re: Stop Forum Spam
Post by: SleePy on April 20, 2022, 09:19:22 PM
Technically no.  There is ip_address and ip_address2 (proxy check ip).  I can in a future update maybe have it show the IP in parenthesis.
Title: Re: Stop Forum Spam
Post by: Matthias on May 04, 2022, 07:15:00 AM
SMF 2.0.19; Mod Version 1.1

Here's what I noticed:
There is an input field, but no description of what the field is for.

(https://up.picr.de/43540170jo.jpg)
Title: Re: Stop Forum Spam
Post by: Shades. on May 04, 2022, 11:20:02 AM
Quote from: Matthias on May 04, 2022, 07:15:00 AMThere is an input field, but no description of what the field is for.
Good catch! I have the same in 2.1.1! ???
Title: Re: Stop Forum Spam
Post by: SleePy on May 04, 2022, 08:57:53 PM
All fixed up.  It was a rename of things due to a complex SMF bug that won't be fixed in 2.1..
Title: Re: Stop Forum Spam
Post by: landyvlad on May 04, 2022, 10:57:27 PM
OK so I am running httpBL (but thats becoming problematic so I have been looking for alternatives especially for when I upgrade to 2.1)

Is anyone running this succesfully with demonstrated results on 2.0.19?
If so I may install this on the existing forum. 
Title: Re: Stop Forum Spam
Post by: njcyx on May 10, 2022, 05:00:54 PM
Is this mod (v1.2) also compatible with SMF 2.1.2?
Title: Re: Stop Forum Spam
Post by: SleePy on May 10, 2022, 05:11:11 PM
I am not aware of any compatibility issues.
Title: Re: Stop Forum Spam
Post by: Metaltype on May 17, 2022, 06:41:12 PM
Hi, Really appreciating this Mod, on the whole it works great.

However, I recently had a person want to use the username Jason and it wouldn't let him.

It led me to realise I didn't understand this setting:

(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fmetaltype.co.uk%2Fforum22%2Fsfs.png&hash=32eb88469e9c990263d6ba675de6ae25f630ead3)

I've now disabled the check username option to allow him to use the board.

Would changing that number do anything?

Would checking the box further down in the settings that says ignore wildcard username checks be a better option than disabling username checks?

Sorry to ramble on a bit, just wondering what the best option is.
Title: Re: Stop Forum Spam
Post by: Kindred on May 17, 2022, 08:31:36 PM
?? ??

You can set reserved names in the core software. Separate from this mod
Title: Re: Stop Forum Spam
Post by: SleePy on May 17, 2022, 09:58:13 PM
https://www.stopforumspam.com/search?q=Jason

You can see that "Jason" has been reported many times.  The Confidence level is returned by the API for how much it believes "Jason" is likely a spammer.  I realize that the Stop Forum web site doesn't show the confidence level, only the API.

http://api.stopforumspam.org/api?username=Jason&json

You can see by the API test, it is reporting it as 72.73 right now.  You can set it to 75 right now and it would let Jason through.  If you notice more spammers are getting through using more common spammer names, you can lower the threshold.

If you check the ignore wildcard usernames, it sends to the API to do exact match for "Jason", but it doesn't seem to change anything here.

If you are wondering more about data that is received by the mod, you can enable the debugging of SFS requests, to see all the data as returned by the API.  This is not really meant to run in production, but can help answer questions about the data being received.
Screen Shot 2022-05-17 at 6.56.32 PM.png
Title: Re: Stop Forum Spam
Post by: Metaltype on May 18, 2022, 04:32:37 AM
Thanks for the prompt reply. Changed setting to 75, everything OK for now.
Thanks
Title: Re: Stop Forum Spam
Post by: Steve on May 18, 2022, 06:27:58 AM
Is not the default setting for the box labeled 'Check Username?' set to unchecked?

And if so, wouldn't it let anyone's names through provided the other criteria aren't met?

And lastly, do you recommend leaving the box unchecked?
Title: Re: Stop Forum Spam
Post by: SleePy on May 18, 2022, 07:10:40 PM
Its not checked by default.  As seen, it can produce false positives.  But if you are getting hit hard, it may be worth trying to enable it and see if it helps curve spammers.  You may want to disable the wildcard matching as I indicated, it will match any name on partials.
Title: Re: Stop Forum Spam
Post by: Steve on May 19, 2022, 07:45:29 AM
Thanks SleePy.  :)
Title: Re: Stop Forum Spam
Post by: GL700Wing on May 24, 2022, 02:10:53 AM
For SMF 2.0 this mod cannot be uninstalled because of an error in the package file 'sfs_hooks_remove.php' - there is a comma missing at the end of the second last hook name.

The only way I could uninstall the mod was to delete the previous package file from the './Packages' directory/folder and upload a new package file that contains a fixed version of 'sfs_hooks_remove.php'.

Find:
    'integrate_manage_logs' => 'SFSA::hook_manage_logs'
Replace with
    'integrate_manage_logs' => 'SFSA::hook_manage_logs',
Title: Re: Stop Forum Spam
Post by: SleePy on May 25, 2022, 07:51:23 PM
All fixed up in v1.3  Fixed a issue with the tracking page as well not showing details like it was supposed to and a undefined index issue on logs.
Title: Re: Stop Forum Spam
Post by: Мel on June 24, 2022, 01:28:26 PM
Right after I install this mod I got this error:
Parse error: syntax error, unexpected ':', expecting ';' or '{' in /home/me/forum/Sources/SFS.php on line 46How do I fix this, or how do I uninstall this mod manually? Can't find install guide anywhere.

2.0.19, PHP 7.3.27.
Title: Re: Stop Forum Spam
Post by: Doug Heffernan on June 24, 2022, 01:47:40 PM
Quote from: Мel on June 24, 2022, 01:28:26 PMRight after I install this mod I got this error:
Parse error: syntax error, unexpected ':', expecting ';' or '{' in /home/me/forum/Sources/SFS.php on line 46How do I fix this, or how do I uninstall this mod manually? Can't find install guide anywhere.

2.0.19, PHP 7.3.27.

A mod broke my forum (https://wiki.simplemachines.org/smf/A_mod_broke_my_forum)
Title: Re: Stop Forum Spam
Post by: Steve on June 24, 2022, 01:57:54 PM
Also, can you bump up your PHP any higher than 7.3.x?
Title: Re: Stop Forum Spam
Post by: Мel on June 24, 2022, 02:58:47 PM
Quote from: Doug Heffernan on June 24, 2022, 01:47:40 PM
Quote from: Мel on June 24, 2022, 01:28:26 PMRight after I install this mod I got this error:
Parse error: syntax error, unexpected ':', expecting ';' or '{' in /home/me/forum/Sources/SFS.php on line 46How do I fix this, or how do I uninstall this mod manually? Can't find install guide anywhere.

2.0.19, PHP 7.3.27.


A mod broke my forum (https://wiki.simplemachines.org/smf/A_mod_broke_my_forum)
Somehow it's not fixing the issue, tried it several times.
Quote from: Steve on June 24, 2022, 01:57:54 PMAlso, can you bump up your PHP any higher than 7.3.x?
I can ask my hosting provider. Should it work?
Title: Re: Stop Forum Spam
Post by: Steve on June 24, 2022, 03:37:32 PM
I don't know that it has anything to do with it but you're on a deprecated version.
Title: Re: Stop Forum Spam
Post by: Arantor on June 24, 2022, 03:40:55 PM
Likely the mod requires 7.4 for its new features. Can't confirm as on mobile but the error is suggestive to me.
Title: Re: Stop Forum Spam
Post by: Мel on June 24, 2022, 05:02:54 PM
I see.
Title: Re: Stop Forum Spam
Post by: Doug Heffernan on June 24, 2022, 05:04:44 PM
Quote from: Steve on June 24, 2022, 01:57:54 PMAlso, can you bump up your PHP any higher than 7.3.x?

Good catch there @Steve. I missed that part about the php version.

Quote from: Мel on June 24, 2022, 02:58:47 PMI can ask my hosting provider. Should it work?

Do you have cPanel? Most cPanels allow for changing of php versions. And yes, that will work.
Title: Re: Stop Forum Spam
Post by: SleePy on June 25, 2022, 11:00:03 AM
Well it would be erroring on the return type, but I thought return types where in 7.1
Title: Re: Stop Forum Spam
Post by: Arantor on June 25, 2022, 11:07:18 AM
Return types are in 7.0, void and nullable came in 7.1, expansions to contravariant returns in 7.4.

But what I see now I can see the source... suggests a lack of the above user having PHP 7.0 at all.
Title: Re: Stop Forum Spam
Post by: Мel on June 27, 2022, 01:56:15 PM
Quote from: Doug Heffernan on June 24, 2022, 05:04:44 PMDo you have cPanel? Most cPanels allow for changing of php versions. And yes, that will work.
I do, but I'm not sure how to do so.
Title: Re: Stop Forum Spam
Post by: Steve on June 27, 2022, 03:11:44 PM
Piece of cake. Log in to your cPanel and then scroll to the 'Software' section. Click on the 'Multi-PHP Manager' and it's pretty self-explanatory from there.
Title: Re: Stop Forum Spam
Post by: Мel on June 28, 2022, 08:08:15 AM
Quote from: Steve on June 27, 2022, 03:11:44 PMPiece of cake. Log in to your cPanel and then scroll to the 'Software' section. Click on the 'Multi-PHP Manager' and it's pretty self-explanatory from there.
Thanks, seems easy. It's marked as "inherited" and it looks that I can up it to any version till 7.4. If I do that, is there any chance that the forum will crash or something else would happen?) Or is it smooth sailing?
Title: Re: Stop Forum Spam
Post by: Steve on June 28, 2022, 08:23:27 AM
No chance that I know of so it should be smooth sailing. There's always that dreadful minuscule chance something could go wrong so back everything up first.
Title: Re: Stop Forum Spam
Post by: Мel on June 28, 2022, 04:55:30 PM
Yeah, everything seems fine, yet there are some mistakes like
Call to a member function versionCheck() on nullI'll try to reinstall this mod a bit later.
Thanks.
Title: Re: Stop Forum Spam
Post by: Мel on June 30, 2022, 05:54:54 AM
Can't use admin panel with this error :(
Title: Re: Stop Forum Spam
Post by: Мel on July 02, 2022, 05:37:37 AM
Any advice please?
Title: Re: Stop Forum Spam
Post by: Diego Andrés on July 02, 2022, 01:30:09 PM
I could not reproduce the issue with 2.0.19 and PHP 7.4
Title: Re: Stop Forum Spam
Post by: SleePy on July 02, 2022, 11:13:48 PM
You can delete all related intergrate_* from the settings table and it will remove all hooks that power the customization.  If other customizations are using the hook, you need to delete it carefully, its a comma delimited list.
Title: Re: Stop Forum Spam
Post by: Мel on July 03, 2022, 04:30:54 AM
Not quite got it. Maybe there is an installation manual for this mod, so I can backtrace all the changes and remove it?
Title: Re: Stop Forum Spam
Post by: Мel on July 04, 2022, 07:49:54 AM
I restored the backup, everything seems fine, thanks.
Title: Re: Stop Forum Spam
Post by: Steve on July 04, 2022, 09:00:35 AM
Perfect example of why everyone should do backups, backups, backups before installing any mod or making any other changes to your forum.  :)
Title: Re: Stop Forum Spam
Post by: XVenomX on September 12, 2022, 03:57:27 PM
Hi, any help how to fix?
Captura de pantalla 2022-09-12 165334.png
Title: Re: Stop Forum Spam
Post by: Doug Heffernan on September 12, 2022, 04:20:03 PM
Quote from: XVenomX on September 12, 2022, 03:57:27 PMHi, any help how to fix?
Captura de pantalla 2022-09-12 165334.png

It looks like the language files have not been added. Uninstall it, and then re-install it again.
Title: Re: Stop Forum Spam
Post by: SleePy on September 12, 2022, 07:22:31 PM
Agreed.  Looks like the language files did not deploy.  Your languages directory (/Themes/default/languages) needs to be writable.  You can check the StopForumSpam.english.php language file there.
Title: Re: Stop Forum Spam
Post by: XVenomX on September 12, 2022, 09:35:21 PM
Thanks  :)
For some reason the files were not extracted and the folder was writable so I did it manually, thanks a lot.
Title: Re: Stop Forum Spam
Post by: SulevFan on October 11, 2022, 06:17:06 PM
Running SMF 2.1.2, Installed version of this mod is 1.3.

I cannot find any options to either check a member or submit a member to the SFS database? We have an API key, and in the previous version of SMF, we could do the above.
Title: Re: Stop Forum Spam
Post by: SulevFan on October 12, 2022, 02:34:11 PM
Quote from: SulevFan on October 11, 2022, 06:17:06 PMRunning SMF 2.1.2, Installed version of this mod is 1.3.

I cannot find any options to either check a member or submit a member to the SFS database? We have an API key, and in the previous version of SMF, we could do the above.

Could someone perhaps at least screenshot the user Interface of how these actions are being done in the new version? Thanks? Little bit lost here.
Title: Re: Stop Forum Spam
Post by: PeakFox on October 17, 2022, 11:39:53 AM
Hi,

I'm unable to delete SFS log file entries with v1.3 and SMF 2.0.19. After clicking the Delete button, all entries are still there and nothing has been deleted.
Title: Re: Stop Forum Spam
Post by: Steve on October 17, 2022, 01:53:52 PM
Did you do a hard refresh on your browser?
Title: Re: Stop Forum Spam
Post by: Shades. on October 17, 2022, 03:32:49 PM
Quote from: SulevFan on October 12, 2022, 02:34:11 PMCould someone perhaps at least screenshot the user Interface of how these actions are being done in the new version? Thanks? Little bit lost here.
It's under the users profile (see attachment)

SPS.PNG
Title: Re: Stop Forum Spam
Post by: SulevFan on October 17, 2022, 04:59:36 PM
Oh man, and there it is, plain as the nose on my face. Thank you.
Title: Re: Stop Forum Spam
Post by: SleePy on October 17, 2022, 07:04:30 PM
Quote from: PeakFox on October 17, 2022, 11:39:53 AMHi,

I'm unable to delete SFS log file entries with v1.3 and SMF 2.0.19. After clicking the Delete button, all entries are still there and nothing has been deleted.
There is a safety function that retains the logs for 24 hours.  Anything older than 24 hours can be deleted
https://github.com/jdarwood007/smfmod_sfs/blob/63df68b38ecccc6cb432346713a8b3f434cc8911/SFS-Subs-Logs.php#L832
https://github.com/jdarwood007/smfmod_sfs/blob/63df68b38ecccc6cb432346713a8b3f434cc8911/SFS-Subs-Logs.php#L859
Title: Re: Stop Forum Spam
Post by: PeakFox on October 18, 2022, 12:10:14 PM
Quote from: SleePy on October 17, 2022, 07:04:30 PMThere is a safety function that retains the logs for 24 hours.  Anything older than 24 hours can be deleted
Aha I see, thanks. Just checked again and it worked after 24h.
Title: Re: Stop Forum Spam
Post by: EL34 on January 05, 2023, 12:35:02 PM
Hi Sleepy
I added this info to your Github page but I am posting it here also in case others are interested in this also.



On my forum, I get assaulted by known spammers every day
This morning, there were 10 attempts to register that all had two or more spam data base hits

I would like to be able to set my registration parameters to not allow registering if the IP AND Email are in the spam data base.
There's no reason I would ever allow any of these attempts to become forum members

On my web site, I send IP's that are trying to abuse PHP scripts to a 404 page.
The attempts from that IP stop after that

User name is not important to me because the Name BOB is in the spam database, but if that user name is not taken, I would allow BOB to join the forum if his IP and Email were not in the spam data base.

My registration rule would be something like this
If the IP and Email are in the spam database, send the spammer to some other page
Maybe even report them so that the username gets tagged also in case that was not in the spam data base

Look at the screen shot from this mornings registration attempts



ForumSpammers.png
Title: Re: Stop Forum Spam
Post by: EL34 on January 06, 2023, 10:42:43 AM
And here is the next morning - Spammers trying to register

Note that all of these would have been rejected except Michaelmot
But when I looked up the IP, it was in Russia
I would have manually rejected Michaelmot

If IP and Email are in the spam data base = reject registration

ForumSpammers2.png
Title: Re: Stop Forum Spam
Post by: Shades. on January 06, 2023, 01:01:30 PM
Are you sure you're posting in the right thread? This looks like the 2.0 version here (https://custom.simplemachines.org/index.php?mod=1547)! ;)
Title: Re: Stop Forum Spam
Post by: EL34 on January 06, 2023, 01:08:39 PM
Hi Shades
My forum is 2.0.19
Title: Re: Stop Forum Spam
Post by: Shades. on January 06, 2023, 01:16:36 PM
Quote from: EL34 on January 06, 2023, 01:08:39 PMHi Shades
My forum is 2.0.19
Right but this mod doesn't have the options you posted in your screenshot as far as I know. That's why I posted the other link here (https://custom.simplemachines.org/index.php?mod=1547)! 8)
Title: Re: Stop Forum Spam
Post by: EL34 on January 06, 2023, 01:20:12 PM
What options?

Sleepy said a while back that he may look into adding some options
I am just updating info so he can see this is really needed.
Title: Re: Stop Forum Spam
Post by: SleePy on January 06, 2023, 10:38:25 PM
I haven't had time to look into this.  I've had personal things to attend to.  Its tracked so I can when I get time.
Title: Re: Stop Forum Spam
Post by: Sudhakar Arjunan on March 13, 2023, 02:20:00 PM
Waiting for update on this version for 2.1.3
Title: Re: Stop Forum Spam
Post by: Steve on March 13, 2023, 07:29:00 PM
Quote from: Sudhakar Arjunan on March 13, 2023, 02:20:00 PMWaiting for update on this version for 2.1.3
Why? It works just fine on my 2.1.3 ...
Title: Re: Stop Forum Spam
Post by: Sudhakar Arjunan on March 15, 2023, 04:45:12 PM
Quote from: Steve on March 13, 2023, 07:29:00 PM
Quote from: Sudhakar Arjunan on March 13, 2023, 02:20:00 PMWaiting for update on this version for 2.1.3
Why? It works just fine on my 2.1.3 ...

Oh you have upgraded with emulator or how did you get it worked after 2.1.3 upgrade.
I get install error after trying to install it using emulator for 2.1.3
Title: Re: Stop Forum Spam
Post by: Shades. on March 15, 2023, 05:00:53 PM
Quote from: Sudhakar Arjunan on March 15, 2023, 04:45:12 PMI get install error after trying to install it using emulator for 2.1.3
You should not have to use Emulate to install this mod on 2.1.3!

1. What errors are you getting when you try to install?
2. What other mods do you have installed?
Title: Re: Stop Forum Spam
Post by: von Corax on August 26, 2023, 12:26:45 PM
I've just installed Stop Forum Spam v1.4 on SMF 2.0.19. When I try to use the "Test SFS" function I get the error message "Unsupported operand types: array + null"
Title: Re: Stop Forum Spam
Post by: SleePy on August 27, 2023, 05:36:29 PM
Hi,

Open $sources/SFS-Subs-Admin.php.php

Find:
// Parse all the responses out.
foreach ($this->context['sfs_checks'] as $key => &$res)
$res[0] += $response[$key][0];

Replace with:
// Parse all the responses out.
foreach ($this->context['sfs_checks'] as $key => &$res)
$res[0] += $response[$key][0] ?? [];
Title: Re: Stop Forum Spam
Post by: Steve on August 28, 2023, 07:15:59 AM
@SleePy - Is that something we should all do or is that tailored to a specific poster's problem?
Title: Re: Stop Forum Spam
Post by: SleePy on August 28, 2023, 11:39:16 PM
You can do it.  Its fixing a issue where the data is returning null rather than an array and PHP is more strict about type handling, throwing a error about merging an array and null.  I have a update I was working on that I will release someday soonish that will include the fix. https://github.com/jdarwood007/smfmod_sfs/pull/16/commits/08fc46565e7bb35f3ce87c3d566a02308cfcf743

I believe that PHP 8.2+ complains, so if your on 8.1 or below, you shouldn't get the error.
Title: Re: Stop Forum Spam
Post by: Steve on September 07, 2023, 07:12:31 AM
There is a conflict between this mod and the Topic Participants mod. I posted about the problem here: https://www.simplemachines.org/community/index.php?msg=4159497 but found out that if I remove this mod and then add the Topic Participants one, the error I was getting goes away.

Just making you aware of it.
Title: Re: Stop Forum Spam
Post by: SleePy on September 10, 2023, 08:15:20 PM
I'm not getting the error.

Your steps are to
1. Go to ACP > Error Log
2. Truncate Error Log
3. Navigate to Home
Title: Re: Stop Forum Spam
Post by: woolly bugger on September 11, 2023, 09:17:01 AM
running smf 2.1.4 just uninstlled SFS 1.4 and tried to install 1.5.1 and it hoses the board.

during the install the screen changed to:

"This page isn't working right nowwww.brfff.com can't currently handle this request.
HTTP ERROR 500"


Help!
Title: Re: Stop Forum Spam
Post by: Steve on September 11, 2023, 10:14:51 AM
@SleePy, for reference regarding @woolly bugger's post: Installing mod hosed my board? (https://www.simplemachines.org/community/index.php?topic=586931.0)
Title: Re: Stop Forum Spam
Post by: SleePy on September 11, 2023, 08:32:36 PM
I can't reproduce that.  I uninstalled the 1.4 and installed the 1.5.1 without any errors.

You can use repair_settings.php tool (on downloads page) to remove hooks.  Upon removal of hooks you can uninstall the mod and reinstall it.  You could also try fix_packages tool but it may not load if SMF isn't working.
Title: Re: Stop Forum Spam
Post by: woolly bugger on September 12, 2023, 09:02:36 AM
Quote from: SleePy on September 11, 2023, 08:32:36 PMI can't reproduce that.  I uninstalled the 1.4 and installed the 1.5.1 without any errors.

You can use repair_settings.php tool (on downloads page) to remove hooks.  Upon removal of hooks you can uninstall the mod and reinstall it.  You could also try fix_packages tool but it may not load if SMF isn't working.

i think it was a PHP version problem -- up graded to 8.2 but now I see that the errors I was getting may need to downgrade to 8.1?? to eliminate errors.
Title: Re: Stop Forum Spam
Post by: SleePy on September 12, 2023, 07:48:02 PM
What errors are you getting?
PHP 8.2 just complains a bit more about type juggling.  Mostly it shouldn't cause issues, just warnings.  SMF has been fixing issues regarding this.
Title: Re: Stop Forum Spam
Post by: woolly bugger on September 22, 2023, 09:36:29 AM
ERROR messages after install,

Hook call: function "SFS::hook_pre_profile_areas" in file /home/XXXXX/public_html/forum could not be called.


mods instslled
mods9-23.jpg
Title: Re: Stop Forum Spam
Post by: SleePy on September 22, 2023, 07:48:20 PM
I fixed it up in 1.5.2.
Title: Re: Stop Forum Spam
Post by: Naytheet on September 29, 2023, 09:40:42 AM
typos in SFS-Admin.php :

$config_vars = $this->getConfiguraiton();

$this->saveConfiguraiton($config_vars);
Title: Re: Stop Forum Spam
Post by: ZabiinoOo on October 13, 2023, 02:35:21 AM
have errors this mod

PHP Parse error:  syntax error, unexpected 'array' (T_ARRAY), expecting variable (T_VARIABLE) in Sources/StopForumSpam.php on line 16

line 16:
private array $changedSettings = [];
Title: Re: Stop Forum Spam
Post by: live627 on October 13, 2023, 07:19:05 AM
Can you upgrade your PHP? The latest update seems to have introduced changes that break on older PHP.
Title: Re: Stop Forum Spam
Post by: SleePy on October 15, 2023, 11:19:01 AM
Yes, the type hints are PHP 8.0.  You should upgrade your php to a supported release: https://www.php.net/supported-versions.php
Also note that 8.0 is also no longer getting security fixes in one month.  However some distros will backport security fixes still.
Title: Re: Stop Forum Spam
Post by: Naytheet on October 15, 2023, 11:23:01 AM
Your web hosting company just give instruction on how to update it, I just had to click on a button in my client area.
Title: Re: Stop Forum Spam
Post by: MobileCS on October 18, 2023, 01:25:37 PM
Any chance of you adding an option to disable the "logAction" part?

It's making me think there are actual forum errors, when it's just a block notice.

The logs in "SFS Logs" is more than enough for me.

Title: Re: Stop Forum Spam
Post by: MobileCS on October 18, 2023, 03:54:07 PM
Sorry, I meant "fatal_error".

An option to turn this :

fatal_error($this->txt('sfs_request_blocked'));
in to this :

fatal_error($this->txt('sfs_request_blocked'), false);
Title: Re: Stop Forum Spam
Post by: SleePy on October 19, 2023, 07:36:58 PM
I've updated to 1.5.3 which fixes that.  if you applied that change, you don't need to upgrade.  Only other change was a typo correction.
Title: Re: Stop Forum Spam
Post by: MobileCS on October 19, 2023, 08:44:57 PM
Thanks!
Title: Re: Stop Forum Spam
Post by: MobileCS on October 20, 2023, 10:26:17 PM
This might be just a personal preference, but you may want to open links in a new window when clicking on the IP addresses in the SFS logs section.

I added 'target="_blank" to the links on lines 701, 702, 732, 734, 736 and it's working just fine.

Thanks again for all your hard work. This mod is working really well on my forum.
Title: Re: Stop Forum Spam
Post by: Steve on October 21, 2023, 10:43:54 AM
Or you just could 'ctrl + click' on the link ...
Title: Re: Stop Forum Spam
Post by: MobileCS on October 21, 2023, 12:45:48 PM
True, but that requires 2 extra steps - one to hold [CTRL] and another to click on the new tab to view it.

My method automatically brings the new tab in to view. Again, just a personal preference.
Title: Re: Stop Forum Spam
Post by: SleePy on October 21, 2023, 03:33:14 PM
Middle click also works if you have a mouse with that (scroll wheel is sometimes middle click).
Title: Re: Stop Forum Spam
Post by: ZabiinoOo on October 21, 2023, 04:53:53 PM
much errors have this mod:
PHP Parse error:  syntax error, unexpected 'array' (T_ARRAY), expecting variable (T_VARIABLE) in /Sources/StopForumSpam.php on line 16

line 16:
private array $changedSettings = [];
Title: Re: Stop Forum Spam
Post by: SleePy on October 21, 2023, 07:30:03 PM
You are using a older version of PHP.  The error is related to a new feature in PHP 8.0 and higher.  Ask your host to move you to a PHP 8.0 or higher release.  Some hosts allow you to change this in your control panel as well.
Title: Undefined array key "ip", SFS Failed as no data was sent
Post by: Ottokar on December 07, 2023, 04:47:53 AM
PHP 8.2.x
SMF 2.1.4
SFS 1.5.3 (only 'Check Email? (Recommended)' is active; 'Checks Required' is at 'Email & IP Address')

This Mod generates permanently errors at the registration prozess:
Undefined array key "ip"Backtrace information see attach.

Another special error:
SFS Failed as no data was sent:https://api.stopforumspam.org/api?json¬orexit&expire=90Backtrace information see attach.
I think, the session was ended while the user write the post. And as he send the post, he was redirected to login, at which loosing sfs the data.
Title: Re: Stop Forum Spam
Post by: SleePy on December 09, 2023, 02:54:15 PM
Looks like no data is being sent back.  Which is odd.  What is the IP address that registers the error?  It must be in a invalid format for the API to reject.
Title: Re: Stop Forum Spam
Post by: Ottokar on December 16, 2023, 08:06:48 AM
With setting 'Checks Required' at 'Any [Email or Username | IP] (Default)' i get no more
Undefined array key "ip" errors. Imho it's a mod bug.

The error
SFS Failed as no data was sent:https://api.stopforumspam.org/api?json¬orexit&expire=90occurred for the second time today.
The error occure, if the login session has expiried before the user has send the post.
With this, if the user submit the post, he will be redirected to the login page first and has to log in again before the post was send.
During this process SFS apparently loses the data.
Title: Re: Stop Forum Spam
Post by: SleePy on December 16, 2023, 11:52:57 AM
Give me more error details.  File and line number also help.

What I'm seeing so far is the API is not responding.  The undefined ip could be a lots of things.  A users session timeout would not break the mod. It does not use any session data.  SMF however does do session checks of its own.
Title: Re: Stop Forum Spam
Post by: Ottokar on December 24, 2023, 01:16:37 PM
For more error details look the first attachment in #106.

Quote from: SleePy on December 16, 2023, 11:52:57 AMA users session timeout would not break the mod.
Yes, it does.

The user has logged in.
While the user writes the post, the session time expires.
Then, if the user sends the post, he was redirected to the login.
At that the mod loses the variables and/or their values.
Therefore the mod sends empty variables, what triggers the error.
I have reproduce the error several times now and that's exactly what happened.
Title: Re: Stop Forum Spam
Post by: SleePy on December 24, 2023, 02:34:21 PM
I still can't reproduce this or get this error.

Using a test account, I got to make a post, I modified the HTML code with dev tools and changed the hidden session data being passed in the form (triggers a session failed check).  I got the SFS response that my post was blocked because it was found in the SFS database.  I checked the SFS logs, and saw it logged the data:
Username:test
Email:[email protected]
Ip:127.0.0.1
Ip:127.0.0.1

I checked the error logs, no errors were registered.  I even tested this as a guest, doing the same page manipulation on the registration page and getting the session timeout error.  No errors were logged.

There are no variables maintained in the session for this.  The mod will grab the IP from the $user_info['ip'] before sending it, which SMF has already set from QueryString.php logic to determine the REMOTE_ADDR.  The email for a registered user is passed from $user_info['email'].  Username also passes from $user_info['name'].  For guests, it handles it via the submitted $_POST data.  At no time is this mod using session data to handle the checks.  You can see the Code (https://github.com/search?q=repo%3Ajdarwood007%2Fsmfmod_sfs%20session&type=code) and the only session checks are for the logs and handling submission to SFS.  SMF 2.0 does modify the existing verification code to add in code calls for SFS, but 2.1 uses a Hook.

I'm not able to figure out where it comes from if you are seeing that.

What version of PHP do you have?
What version of SMF are you running?
What does your SFS settings page look like?  You can blur out the API key, I don't need that.  I need to see all the other settings, so I can configure my test environment to match and try to reproduce it.
What other mods are you running?
Title: Re: Stop Forum Spam
Post by: Ottokar on December 31, 2023, 07:42:30 AM
Look at the attached debug info, Member ist 'Guest', but Username and Email are empty, does that cause the error?
In StopForumSpam.php the code in line 255 grabs Username and Email from $_POST data. But there is no data because the user is no Guest, it's a member, and posting for guests is not allowed.
All Anti-Spam Verification options are set.

PHP 8.2.x
SMF 2.1.4
SFS 1.5.3
Title: Re: Stop Forum Spam
Post by: SleePy on December 31, 2023, 08:26:41 PM
Do you have the setting enabled called 'Do not show the email field for guests' posts'? (ACP > Forum > Posts and Topic > Post Settings)  That setting allows email to not be submitted.

Digging into the code, SMF does seem to check the verification first, so that is fun.  It should be checking the basic things first before checking the verification stuff.  Looks like the best option is to move the hook.  Let me think about this.

In the short term, if you check IPs, the error would stop, it would only be checking IPs, but if they are not sending a username or email, it should fail anyways, just passes these checks otherwise.
Title: Re: Stop Forum Spam
Post by: Ottokar on January 04, 2024, 11:38:07 AM
The setting 'Do not show the email field for guests posts' isn't enabled.


If the User click "preview" the post, the error was logged in the SFS Log too. But in this cases ("preview"), the error was only logged in the SFS Log, not in the Forum SMF Logs.
Title: Re: Stop Forum Spam
Post by: SleePy on January 05, 2024, 07:11:28 PM
Try this.
In StopForumSpam.php

Find:
$guestname = !isset($_POST['guestname']) ? '' : trim($_POST['guestname']);
$email = !isset($_POST['email']) ? '' : trim($_POST['email']);

Replace:
$guestname = !isset($_POST['guestname']) ? '' : trim(normalize_spaces(sanitize_chars($_POST['guestname'], 1, ' '), true, true, array('no_breaks' => true, 'replace_tabs' => true, 'collapse_hspace' => true)));
$email = !isset($_POST['email']) ? '' : trim($_POST['email']);

// SMF will take care of these if we are checking them.
if (!empty($this->modSettings['sfs_emailcheck']) && empty($modSettings['guest_post_no_email']) && empty($email))
return false;
else if (!empty($this->modSettings['sfs_usernamecheck']) && empty($guestname))
return false;

It should stop the API from being requested but depends on SMF processing its own checks to reject the submission for an empty username and empty email.

Another thing to note is these are most likely bots, as the UI has a required attribute on the email and username boxes, which should prevent the browser from accepting the post filling them in.
Title: Re: Stop Forum Spam
Post by: Skhilled on January 09, 2024, 08:24:17 PM
Hi Sleepy,

SMF has removed the ability to use wildcards in email address to ban accounts on registration in v2.1 like the follow as v2.0 used to do: *@*.*.someserver.net.

Does this mod allow you to do that? There are a lot of hackers/bots that are using this along with suspected email accounts. Am I missing something, or should I report this to Stop Forum Spam instead?
Title: Re: Stop Forum Spam
Post by: Ottokar on January 11, 2024, 06:30:10 AM
Quote from: SleePy on January 05, 2024, 07:11:28 PMTry this.
I will try this, thank you.

Quote from: SleePy on January 05, 2024, 07:11:28 PMAnother thing to note is these are most likely bots
I checked the IPs, all errors are caused by users.
Title: Re: Stop Forum Spam
Post by: SleePy on January 13, 2024, 09:34:13 PM
Quote from: Skhilled on January 09, 2024, 08:24:17 PMHi Sleepy,

SMF has removed the ability to use wildcards in email address to ban accounts on registration in v2.1 like the follow as v2.0 used to do: *@*.*.someserver.net.

Does this mod allow you to do that? There are a lot of hackers/bots that are using this along with suspected email accounts. Am I missing something, or should I report this to Stop Forum Spam instead?

I wasn't aware of any change regarding that.  It may have been accidental with changes regarding alignment to RFC if we did anything.

This mod won't change anything in regards to that, it is checking the Stop Forum Spam (https://www.stopforumspam.com/) API.  So if the email is registered in that API, then it would stop it.  It can optionally even ban them to stop more attempts.

If you want to ban the wildcard usage, you can add a ban for that.  MySQL and PostgreSQL both use % and _ for wildcards, so you can use * safely in your ban.  SMF otherwise will do a lookup for email matching.

Try banning %@%.%.someserver.net  and it should work
Title: Re: Stop Forum Spam
Post by: Skhilled on January 16, 2024, 07:52:04 PM
It will not allow me to do it. I've tried on several SMF forums as well as one without any mods on it...only themes are on it. They all say, "Please enter an email address." This happens whether I use a "%, *, or _" with wildcards. And, StopForumSpam is only installed on the first site I mentioned, not any of the others. This was happening before I installed StopForumSpam. I installed it in hopes that it would help.
Title: Re: Stop Forum Spam
Post by: erich199 on January 19, 2024, 03:06:12 PM
I'm having issues where this is triggering an error in the logs

Type of error: Undefined
2: Undefined array key "sfs_verOptionsMembers"

Seems to be happening when the user is registered and trying to send a pm
Title: Re: Stop Forum Spam
Post by: SleePy on January 20, 2024, 12:58:17 PM
Quote from: Skhilled on January 16, 2024, 07:52:04 PMIt will not allow me to do it. I've tried on several SMF forums as well as one without any mods on it...only themes are on it. They all say, "Please enter an email address." This happens whether I use a "%, *, or _" with wildcards. And, StopForumSpam is only installed on the first site I mentioned, not any of the others. This was happening before I installed StopForumSpam. I installed it in hopes that it would help.

Use * as the wild card. *.*@gmail.com for example works.

Quote from: erich199 on January 19, 2024, 03:06:12 PMI'm having issues where this is triggering an error in the logs

Type of error: Undefined
2: Undefined array key "sfs_verOptionsMembers"

Seems to be happening when the user is registered and trying to send a pm

Do you have any options set for members?
Title: Re: Stop Forum Spam
Post by: Ottokar on January 26, 2024, 04:20:53 AM
Quote from: SleePy on January 05, 2024, 07:11:28 PMTry this.
In StopForumSpam.php

Find:
            $guestname = !isset($_POST['guestname']) ? '' : trim($_POST['guestname']);
            $email = !isset($_POST['email']) ? '' : trim($_POST['email']);

Replace:
            $guestname = !isset($_POST['guestname']) ? '' : trim(normalize_spaces(sanitize_chars($_POST['guestname'], 1, ' '), true, true, array('no_breaks' => true, 'replace_tabs' => true, 'collapse_hspace' => true)));
            $email = !isset($_POST['email']) ? '' : trim($_POST['email']);

            // SMF will take care of these if we are checking them.
            if (!empty($this->modSettings['sfs_emailcheck']) && empty($modSettings['guest_post_no_email']) && empty($email))
                return false;
            else if (!empty($this->modSettings['sfs_usernamecheck']) && empty($guestname))
                return false;

It should stop the API from being requested but depends on SMF processing its own checks to reject the submission for an empty username and empty email.

Another thing to note is these are most likely bots, as the UI has a required attribute on the email and username boxes, which should prevent the browser from accepting the post filling them in.
I changed the code 2 weeks ago, until now there where no new error messages about SFS in the SMF-Logs and no Debug entries in the SFS-Logs.
I'll report again in a few weeks.
Title: Re: Stop Forum Spam
Post by: SleePy on January 31, 2024, 08:06:12 PM
Thanks for the update. https://github.com/jdarwood007/smfmod_sfs/commit/fcfedc9dfddc37fab8583b67b6ab32772557277e

I will get it in the package officially in a few days when I have time to do some last-minute checks for other things I need to update.
Title: Re: Stop Forum Spam
Post by: bazzacad on February 03, 2024, 09:34:44 PM
HELP!
I installed this mod & it crashed my site. I can't even get into the forums to uninstall it.
I just get a "This page isn't working - HTTP ERROR 500".
The installation didn't have any errors.
SMF: 2.0.19
PHP: 7.4.22
SFS: 1.5.4

I tried restoring the backup file: https://wiki.simplemachines.org/smf/A_mod_broke_my_forum.
But it didn't help. I still get the same error: "This page isn't working - HTTP ERROR 500".
Title: Re: Stop Forum Spam
Post by: SleePy on February 03, 2024, 10:18:42 PM
Ask your host how to upgrade to PHP 8.0.

I would also recommend upgrading to SMF 2.1 when you can, but check your mod compatibility.  SMF 2.1 supports PHP 8.1 and higher.
Title: Re: Stop Forum Spam
Post by: Sudhakar Arjunan on February 10, 2024, 06:07:15 PM
Yes once installed on my fresh upgraded smf 2.1.4 the install page blanks out and completely cashes my Forum.
Title: Re: Stop Forum Spam
Post by: Skhilled on February 10, 2024, 09:20:52 PM
I've found ound out the the problems I were having was from Google's recaptcha and not StopForumSpam. Once I've disabled Google's recaptcha the problems went away. ;)

It may be possible that they are incompatible somehow???
Title: Re: Stop Forum Spam
Post by: Lucarella on February 12, 2024, 04:56:45 PM
Hi, I installed this mod, it works but I get a lot of errors like this:
2: Undefined array key "username"
/home/ddcrewne/public_html/forum/Sources/StopForumSpam.php (Linea 457)

Tipo di errore
Undefined_vars
Messaggio di errore
2: Undefined array key "username"
File
/home/ddcrewne/public_html/forum/Sources/StopForumSpam.php
Linea
457
URL della pagina che ha causato l'errore
https://dd-crew.net/forum/index.php?action=signup2
Informazioni di backtrace
#0: smf_error_handler()
Chiamata da /home/ddcrewne/public_html/forum/Sources/StopForumSpam.php nella linea 457
#1: sfsCheckMultiple()
Chiamata da /home/ddcrewne/public_html/forum/Sources/StopForumSpam.php nella linea 391
#2: sfsCheck()
Chiamata da /home/ddcrewne/public_html/forum/Sources/StopForumSpam.php nella linea 178
#3: checkRegisterRequest()
Chiamata da /home/ddcrewne/public_html/forum/Sources/StopForumSpam.php nella linea 146
#4: hook_register()
Chiamata da /home/ddcrewne/public_html/forum/Sources/Subs.php nella linea 5787
#5: call_integration_hook()
Chiamata da /home/ddcrewne/public_html/forum/Sources/Subs-Members.php nella linea 696
#6: registerMember()
Chiamata da /home/ddcrewne/public_html/forum/Sources/Register.php nella linea 531
#7: Register2()
Chiamata da /home/ddcrewne/public_html/forum/index.php nella linea 184

How can I solve it?

Thank you
Title: Re: Stop Forum Spam
Post by: SleePy on February 17, 2024, 10:39:32 AM
@Lucarella,

Open the Sources/StopForumSpam.php

Find:
$test = call_user_func([$this, 'sfsCheck_' . $key], $response[$key], $area);
Replace:
$test = call_user_func([$this, 'sfsCheck_' . $key], $response[$key] ?? [], $area);
@Skhilled,
Are you on SMF 2.0?  Recaptcha is built into 2.1.  I haven't tested it with 2.0 and the Recpatcha mod installed.
Title: Re: Stop Forum Spam
Post by: Skhilled on February 17, 2024, 10:47:06 AM
No, I'm on 2.1 and was using Google's recaptcha and added their keys. When I removed it it worked better. :)
Title: Re: Stop Forum Spam
Post by: Lucarella on February 18, 2024, 06:17:01 AM
Quote from: SleePy on February 17, 2024, 10:39:32 AM@Lucarella,


Thanks for your help
Title: Re: Stop Forum Spam
Post by: KittyGalore on February 18, 2024, 11:46:46 AM
The mod can't be downloaded

An error has occurred
This package appears to have been removed from the remote host. Please contact the mod/theme author to correct.
Title: Re: Stop Forum Spam
Post by: Steve on February 18, 2024, 12:09:58 PM
It works just fine for me Kitty.
Title: Re: Stop Forum Spam
Post by: KittyGalore on February 18, 2024, 12:43:08 PM
Very strange i tried another browser and the same result. Firefox and Chrome.
Title: Re: Stop Forum Spam
Post by: SleePy on February 18, 2024, 01:39:48 PM
Try it now.  Something was odd with GitHub and it stopped wanting to serve the file.
Title: Re: Stop Forum Spam
Post by: KittyGalore on February 18, 2024, 01:42:40 PM
Quote from: SleePy on February 18, 2024, 01:39:48 PMTry it now.  Something was odd with GitHub and it stopped wanting to serve the file.
Yes now it's working thanks.
Title: Re: Stop Forum Spam
Post by: IVIIVI4ck3y27 on March 26, 2024, 06:12:07 PM
I've run into an error with our forum upon trying to install the package. I'm getting the HTTP Error 500 as noted above.  I looked in the error log and it's noting this as the only error for today:

[26-Mar-2024 21:58:37 Africa/Abidjan] PHP Parse error:  syntax error, unexpected '|', expecting variable (T_VARIABLE) in /*****/**********/public_html/*********/forum/Sources/StopForumSpam.php on line 1023

I'm not sure on the Africa/Abidjan as the server is located in the Eastern U.S.  I blanked out the server related info and site name info. in the above shared error log comment.

I also can't run fix_packages.php either (it doesn't seem to access it when pointed at it in a browser despite it being in the root of the forum directory with the SSI and Settings.php files) so kind of stuck at the moment. It's an old forum (not active for a # of years) that I just recently updated to 2.0.19 but I'm not sure what version of PHP and MySQL we're on as it's basically been running for awhile with minimal updates.  I have ran into a lot of spammers just recently and disabled registrations. 

I'd like to revert back but obviously (and quite stupidly) I didn't back things up because... why would I? *SMDH*  Hoping I can just get it to uninstall but not sure if there's a means to?