News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Stop Forum Spam

Started by SleePy, March 21, 2022, 12:11:09 AM

Previous topic - Next topic

SleePy

Quote from: JWJ on October 30, 2024, 10:02:53 AMFollowing a series of troubled upgrades, downgrades, upgrades from 2.0.19 to 2.1.4, as advised in another thread I finally did a 'clean files' install of 2.1.4. It wasn't without it's issues but I eventually succeeded in establishing a clean, error free, install. Once satisfied everything was working I installed the Stop Forum Spam mod. This seems to be working perfectly except that I am getting the following Critical error in my logs.

JSON decode error: Syntax error, malformed JSON
The error is generated in /Sources/ManageServer.php at line 1264. The error occurs as soon as I land on the SFS settings page.

I'd be very grateful for any suggestions as to how to fix this. Thank you.


Looks like its a bug caused from upgrading from 2.0 to 2.1.
You can clear it by simply setting the Guest Verification options.

You can also run this update file, place in your SMF root: https://github.com/jdarwood007/smfmod_sfs/blob/0cdc09095beab1b1bd315b82b41d81adc354cb2c/upgrade_sfs.php

I will look at publishing a new version, once we check your other error.
Quote from: JWJ on October 31, 2024, 07:32:57 AMIn addition to the above, whenever a potential spammer gets blocked I receive an entry in the error log. Being new to 2.1.4 I assumed this was just a way of logging bans, however, I'm now wondering if this is in fact an error that needs fixing.

What sort of error is logged?  I can be PMed if you feel its sensitive 
Jeremy D ~ Site Team / SMF Developer ~ GitHub Profile ~ Join us on IRC @ Libera.chat/#smf ~ Support the SMF Support team!

JWJ

Thanks for the information SleePy.

I unset Guest Verification (it was already set on) but as soon as I landed on the SFS settings page I received the malformed JSON error. I ran the upgrade_sfs file as instructed and that seems to have cleared the problem.

I've attached screen shots of the other error. I hadn't previously looked at the backtrace information but I can see that refers to a fatal error.You cannot view this attachment.You cannot view this attachment.

SleePy

Is that an older error?  The call it is making is no longer used.  Perhaps it is a older hook?
Jeremy D ~ Site Team / SMF Developer ~ GitHub Profile ~ Join us on IRC @ Libera.chat/#smf ~ Support the SMF Support team!

JWJ

No, that's a new error. When I upgraded I did have a number of issues although I finally followed the instructions for a clean install. Is there anything I can do to check the hooks?

JWJ

Sorry to come back on this one but I'm concerned that the Mod isn't reporting spammers to the SFS database. Is there any way I check for sure? Is it possible that the error I'm getting is causing the mod to fail before it completes the reporting step? Is there anything I can do to collect more useful information?

SleePy

SMF doesn't have a good way to check for hooks.  You could uninstall the mod then go to Admin > Maintenance > Forum Maintenance > Integration hooks.  Then look for any hooks with 'SFS' in the name.

If you setup an API key with the Stop Forum Spam database, you can log into your account on their site and see all submissions.
Jeremy D ~ Site Team / SMF Developer ~ GitHub Profile ~ Join us on IRC @ Libera.chat/#smf ~ Support the SMF Support team!

JWJ

I have my API key set up and have checked the Stop Forum Spam database. None of the spammers I am currently getting have been logged in the database and I'm having to add them manually. I thought the SFS mod submitted the spammer details automatically. The mod seems to be blocking spammers already in the database but not adding new ones.

I'll uninstall the mod, remove any hooks with SFS in them and re-install. Thank you.


JWJ

Okay, I uninstalled the mod and when I checked for hooks SMF reported there were none. I reinstalled the mod and now I have 9 hooks, all associated with SFS, as attached.

JWJ

I'm sorry to be a pain but since uninstalling and reinstalling the mod I've started to get a new error. Whenever I go to "SFS logs" I get 4 errors logged. They are all the same error, repeated 4 times. I've attached screenshots of one of the errors and a view of the Backtrace information. I ran the upgrade_sfs.php file but it's made no difference. Is there anything else I can try?

JWJ

Rechecking back through everything I noticed that my SFS version wasn't the latest. I uninstalled it, deleted the files, and then installed the latest v1.5.6 version. The problem still exists.

SleePy

Quote from: JWJ on November 13, 2024, 05:05:38 AMI have my API key set up and have checked the Stop Forum Spam database. None of the spammers I am currently getting have been logged in the database and I'm having to add them manually. I thought the SFS mod submitted the spammer details automatically. The mod seems to be blocking spammers already in the database but not adding new ones.

I'll uninstall the mod, remove any hooks with SFS in them and re-install. Thank you.

You have to tell it to submit a spam post
You cannot view this attachment.

Jeremy D ~ Site Team / SMF Developer ~ GitHub Profile ~ Join us on IRC @ Libera.chat/#smf ~ Support the SMF Support team!

SleePy

Quote from: JWJ on November 15, 2024, 03:58:34 AMRechecking back through everything I noticed that my SFS version wasn't the latest. I uninstalled it, deleted the files, and then installed the latest v1.5.6 version. The problem still exists.

Did the error location change?  The error does not align with the code you provided for those files/lines.
Jeremy D ~ Site Team / SMF Developer ~ GitHub Profile ~ Join us on IRC @ Libera.chat/#smf ~ Support the SMF Support team!

JWJ

Firstly, my bad with regards to reporting to SFS. I hadn't spotted that the reporting had been moved from where it was in my previous 2.0.19 version.

With regards to the "SFS Logs" error, I don't know what you mean by "does not align". I've created a new error and taken screenshots of all 4 log entries. The only difference I can see between them are the last 2 words of the error description, the 1st and 3rd entries referring to 'string given', entry 2 'int given' and entry 4 'float given'. I've also attached the Backtrace information from the 1st entry and again, I can see no difference in the backtrace for each of the 4 entries.

SleePy

That helps, now the code is matching up to the error logged.

I think its some older log entries.  But we can make the code compatible.

Try opening $sourcedir/StopForumSpam/SFS-Logs.php

Find:
foreach ($checksDecoded as $ckey => $vkey) {
foreach ($vkey as $key => $value) {
$checks .= ucfirst($key) . ':' . $value . '<br>';
}
}

Replace:
foreach ($checksDecoded as $ckey => $vkey) {
if (is_array($vkey)) {
foreach ($vkey as $key => $value) {
$checks .= ucfirst($key) . ':' . $value . '<br>';
}
} else {
$checks .= ucfirst($ckey) . ':' . $vkey . '<br>';
}
}
Jeremy D ~ Site Team / SMF Developer ~ GitHub Profile ~ Join us on IRC @ Libera.chat/#smf ~ Support the SMF Support team!

JWJ

That's brilliant!!! Everything is working fine now. Thank you very much for your considerable time.... much appreciated.

brynn

I'm probably a little over my head trying to use this mod. So I have some very newbie type of questions.

On the Mod Settings > SFS, under Verification Options, I could probably not be more confused! The instructions say
QuoteThese options require Anti-Spam Verification options to be setup and configured. Disabling verification options or not requiring them in specific sections will override these options.

We do have Admin > Configuration > Anti-Spam set up with some verification options set up and configured (on registration only). But we don't want to use verification for other things. At least not yet.

To me, the instructions sound like they are saying that if we disallow verification, it will somehow change what we have set on Anti-Spam settings. But that does not entirely make sense to me. Is it trying to say that the settings on Verification Options need to be parallel with the settings on Anti-Spam? ("on" on both pages or "off" on both pages, i.e.)

It's also possible that I don't understand the Verification Options section correctly. Does clicking/highlighting options in those boxes allow or disallow verification on those things? It seems like the tradition is that clicking on something chooses it, but maybe it's choosing it for a different reason than I thought?

I tried un-highlighting Posting in the Guest Verification section (because we do not even allow guest posting, so why would we need verification), but it does not stay un-highlighted after I click Save. So I think I must have a misunderstanding somewhere  ::)

Or it's also possible that I don't understand the highlighting. When I open the page fresh, under Guest Verification, Posting has a gray background (highlight) with black text. But if I click on it, it changes to my theme highlight, which is dark blue background with white text. So maybe the gray highlight does not mean it's actually selected??? Could it be only a suggestion??

Thanks for your patience  :)


SleePy

Quote from: brynn on March 07, 2025, 11:44:07 AMI'm probably a little over my head trying to use this mod. So I have some very newbie type of questions.

On the Mod Settings > SFS, under Verification Options, I could probably not be more confused! The instructions say
QuoteThese options require Anti-Spam Verification options to be setup and configured. Disabling verification options or not requiring them in specific sections will override these options.

We do have Admin > Configuration > Anti-Spam set up with some verification options set up and configured (on registration only). But we don't want to use verification for other things. At least not yet.

To me, the instructions sound like they are saying that if we disallow verification, it will somehow change what we have set on Anti-Spam settings. But that does not entirely make sense to me. Is it trying to say that the settings on Verification Options need to be parallel with the settings on Anti-Spam? ("on" on both pages or "off" on both pages, i.e.)

The basis of the mod hooks into SMF's verification system to extend the checks it performs.  So you need to ensure that SMF is running its verification system.  Checking things such as " Require verification on registration page", then triggers SMF to perform its verification system.

You can leave image, questions and recaptcha off and it should still run the Stop Forum Spam system.  Although I would say in today's environment, adding it onto those will help keep bots at bay.

Quote from: brynn on March 07, 2025, 11:44:07 AMI tried un-highlighting Posting in the Guest Verification section (because we do not even allow guest posting, so why would we need verification), but it does not stay un-highlighted after I click Save. So I think I must have a misunderstanding somewhere  ::)

By selecting it, the SFS logic is performed on that section.  So if you remove it, SFS is not performed.

Quote from: brynn on March 07, 2025, 11:44:07 AMOr it's also possible that I don't understand the highlighting. When I open the page fresh, under Guest Verification, Posting has a gray background (highlight) with black text. But if I click on it, it changes to my theme highlight, which is dark blue background with white text. So maybe the gray highlight does not mean it's actually selected??? Could it be only a suggestion??
Thats all going to be up to how your browser handles displaying the field.  Its a Mutli-select input box in HTML.  Most browsers will show it greyed out because its not a active input box.  When selecting it, the color should change to the highlight color.  But clicking on a item will change with items are selected.  You typically use a modifier key + click to select multiple.
Jeremy D ~ Site Team / SMF Developer ~ GitHub Profile ~ Join us on IRC @ Libera.chat/#smf ~ Support the SMF Support team!

brynn

Thanks for your comments!

QuoteOn the Mod Settings > SFS, under Verification Options, I could probably not be more confused! The instructions say

QuoteThese options require Anti-Spam Verification options to be setup and configured. Disabling verification options or not requiring them in specific sections will override these options.

So disabling verification options (in the mod settings) overrides Anti-Spam Verification options (in Anti-Spam settings)? Is that what it means?

QuoteMost browsers will show it greyed out because its not a active input box.

Ooooohhh, the gray highlight means it's grayed out?! That's why I'm so confused! I've never seen "grayed out" look like that before. Usually when something is grayed out, the text itself is gray, rather than the gray background highlight. No wonder I can't de-select it!  Haha!

One last question. We do not seem to be getting any entries in the SFS logs. Does that mean I have something wrong with the settings? Or does it only log suspicious visitors? (We only opened the forum recently, so it's not getting many visits yet.)

Thanks.

SleePy

Quote from: brynn on March 14, 2025, 05:16:57 AMThanks for your comments!

So disabling verification options (in the mod settings) overrides Anti-Spam Verification options (in Anti-Spam settings)? Is that what it means?

SFS is setup to extend SMF's Anti-spam verification system.  Think of it like a new section.


QuoteOne last question. We do not seem to be getting any entries in the SFS logs. Does that mean I have something wrong with the settings? Or does it only log suspicious visitors? (We only opened the forum recently, so it's not getting many visits yet.)

You should be getting logs, but only about where it took action to block.  Most likely means that it isn't running like you expect if you have a lot of spam still getting through.  You can enable debug logs and it will produce much more verbose logging about what is going on, including logging all queries it sends over to SFS API
Jeremy D ~ Site Team / SMF Developer ~ GitHub Profile ~ Join us on IRC @ Libera.chat/#smf ~ Support the SMF Support team!

brynn

Ok, I think I understand. Thank you very much!

Advertisement: