News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Stop Spammer

Started by M-DVD, December 31, 2008, 07:31:43 AM

Previous topic - Next topic

Kindred

changing the files will not have any effect on the data (which is in the database)

Additionally, always take a backup (of files AND database) before klutzing around. :)
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Nodaz

Quote from: Kindred on December 06, 2019, 03:57:57 PM
changing the files will not have any effect on the data (which is in the database)

Additionally, always take a backup (of files AND database) before klutzing around. :)
Back up in progress, thanks for the patience and advice advice .

KittyGalore

This mod is fantastic but upon installation it gives errors. Can it be updated. I currently use it on my forum but not sure at the time when it gave errors did i install it or do something but on a test forum new install of smf no mods this gives one error in the mangemembers.php file.
SMF Curve 2.0x

Shambles

Quote from: KittyGalore
This mod is fantastic but upon installation it gives errors.
Installation into which version of SMF ?

What, exactly, are the errors you're seeing?

KittyGalore

Quote from: Shambles on January 18, 2020, 07:34:19 AM
Quote from: KittyGalore
This mod is fantastic but upon installation it gives errors.
Installation into which version of SMF ?

What, exactly, are the errors you're seeing?
Sorry i thought i had included the version SMF 2.0.17
This is the code it's trying to replace in the Source ManageMembers.php

Code: (Find) [Select]
if ($context['sub_action'] == 'query' && !empty($_REQUEST['params']) && empty($_POST))

Code: (Replace) [Select]
if ($context['sub_action'] == 'query' && !empty($_REQUEST['params']) && (empty($_POST) || ((isset($_POST['spammers_checks']) || isset($_POST['spammers_report'])) && !empty($_POST['delete']))))

This is the only code i could find from a fresh copy of the file that matches some parts of it.

if ($context['sub_action'] == 'query' && empty($_POST))
{
if (!empty($_REQUEST['params']))
{
$_POST += safe_unserialize(base64_decode($_REQUEST['params']));
}
elseif ($context['browser']['is_ie'] && !empty($_SESSION['params']))
{
$_POST += $_SESSION['params'];
unset($_SESSION['params']);
}
}
SMF Curve 2.0x

Shambles

This is covered already in this very thread.

Eg:  https://www.simplemachines.org/community/index.php?topic=283309.msg3957547#msg3957547


... and in several other places, also in this very thread.

KittyGalore

Quote from: Shambles on January 18, 2020, 01:24:33 PM
This is covered already in this very thread.

Eg:  https://www.simplemachines.org/community/index.php?topic=283309.msg3957547#msg3957547


... and in several other places, also in this very thread.
Thank you i see the codes now i will edit them in. :)
SMF Curve 2.0x

smartmouse

Hello, since SMF 2.1 is in RC2... do you plan to update this mod to make it working with 2.1?
I tried to install the mod, but I had a lot of errors... so I did not install it.

Scooter Trash

QuoteHello, since SMF 2.1 is in RC2... do you plan to update this mod to make it working with 2.1?
I tried to install the mod, but I had a lot of errors... so I did not install it.

Same here. Tried to install on ver. 2.0.17 but got warning so abandoned installation. Unfortunate.

SD-X

Quote from: Scooter Trash on March 21, 2020, 09:58:22 AM
QuoteHello, since SMF 2.1 is in RC2... do you plan to update this mod to make it working with 2.1?
I tried to install the mod, but I had a lot of errors... so I did not install it.

Same here. Tried to install on ver. 2.0.17 but got warning so abandoned installation. Unfortunate.
What errors did you get? It should be working fine on 2.0.x.

Scooter Trash

Quote from: SugarD-x on March 21, 2020, 10:24:52 PM
Quote from: Scooter Trash on March 21, 2020, 09:58:22 AM
QuoteHello, since SMF 2.1 is in RC2... do you plan to update this mod to make it working with 2.1?
I tried to install the mod, but I had a lot of errors... so I did not install it.

Same here. Tried to install on ver. 2.0.17 but got warning so abandoned installation. Unfortunate.
What errors did you get? It should be working fine on 2.0.x.

Execute Modification   ./Sources/ManageMembers.php    Test failed

Replace    ./Sources/ManageMembers.php    Test failed

wylekk

Beautiful toy, all IP blocking manually in .htaccess, and this mod only finds registered users . Who wants to test the mod on SMF 2.1 RC2 here is an adapted file install_21.xml

<?xml version="1.0"?>
<!DOCTYPE modification SYSTEM "http://www.simplemachines.org/xml/modification">
<modification xmlns="http://www.simplemachines.org/xml/modification" xmlns:smf="http://www.simplemachines.org/">
<id>M-DVD:StopSpammer</id>
<name>Stop Spammer</name>
<version>2.3.9</version>

<file name="$sourcedir/ManageRegistration.php">
<operation>
<search position="before"><![CDATA[
require_once($sourcedir . '/ManageServer.php');
]]></search>
<add><![CDATA[
// Test if mod StopSpammer is OK
require_once($sourcedir . '/StopSpammer.php');
$txt['stopspammer_ok'] = stopspammer_test_mod_ok();
$stopspammer_faildb_sub = $txt['stopspammer_faildb_sub'];
]]></add>
</operation>

<operation>
<search position="before"><![CDATA[array('text', 'coppaPhone'),]]></search>
<add><![CDATA[
// Stop Spammer
array('title', 'stopspammer_settings'),
$txt['stopspammer_ok'],
'',
array('check', 'stopspammer_enable', 'subtext' => $txt['stopspammer_enable_sub']),
array('desc', 'stopspammer_check_sub1'),
array('check', 'stopspammer_check_name'),
array('check', 'stopspammer_check_mail'),
array('check', 'stopspammer_check_ip'),
array('desc', 'stopspammer_check_sub2'),
array('select', 'stopspammer_faildb', array($txt['stopspammer_fail01'], $txt['stopspammer_fail02'], $txt['stopspammer_fail03']), 'subtext' => $stopspammer_faildb_sub),
array('check', 'stopspammer_show01', 'subtext' => $txt['stopspammer_show01_sub']),
array('text', 'stopspammer_api_key'),
array('desc', 'stopspammer_api_key_sub'),]]></add>
</operation>
</file>

<file name="$sourcedir/ManageMembers.php">
<!--- Load our functions at the beginning of ViewMembers() for every sa we need --->
<operation>
<search position="before"><![CDATA['query' => array('ViewMemberlist', 'moderate_forum'),
);]]></search>
<add><![CDATA[$_REQUEST['sa'] = isset($_REQUEST['sa']) && isset($subActions[$_REQUEST['sa']]) ? $_REQUEST['sa'] : 'all';
// Load Stop Spammer Functions
if ('all' == $_REQUEST['sa'] || 'browse' == $_REQUEST['sa'] || 'query' == $_REQUEST['sa'] || 'approve' == $_REQUEST['sa'])
{
global $sourcedir;
require_once($sourcedir . '/StopSpammer.php');
}]]></add>
</operation>

<!--- First List - List All Member - BEGIN --->
<operation>
<search position="replace"><![CDATA['sprintf' => array(
'format' => '<a href="' . strtr($scripturl, array('%' => '%%')) . '?action=profile;u=%1$d">%2$s</a>',
'params' => array(
'id_member' => false,
'member_name' => false,
),
),]]></search>
<add><![CDATA['function' => create_function('$rowData', '
global $scripturl;
$url = strtr($scripturl, array(\'%\' => \'%%\')) . \'?action=profile;u=\' . $rowData[\'id_member\'];
return sprintfspamer($rowData, $url, \'member_name\', 2);
'),]]></add>
</operation>

<operation>
<search position="replace"><![CDATA['sprintf' => array(
'format' => '<a href="' . strtr($scripturl, array('%' => '%%')) . '?action=profile;u=%1$d">%2$s</a>',
'params' => array(
'id_member' => false,
'real_name' => false,
),
),]]></search>
<add><![CDATA['function' => create_function('$rowData', '
global $scripturl;
$url = strtr($scripturl, array(\'%\' => \'%%\')) . \'?action=profile;u=\' . $rowData[\'id_member\'];
return sprintfspamer($rowData, $url, \'real_name\', 0);
'),]]></add>
</operation>

<operation>
<search position="replace"><![CDATA['sprintf' => array(
'format' => '<a href="mailto:%1$s">%1$s</a>',
'params' => array(
'email_address' => true,
),
),]]></search>
<add><![CDATA['function' => create_function('$rowData', '
global $scripturl;
$url = \'mailto:\' . $rowData[\'email_address\'];
return sprintfspamer($rowData, $url, \'email_address\', 3);
'),]]></add>
</operation>

<operation>
<search position="replace"><![CDATA['sprintf' => array(
'format' => '<a href="' . strtr($scripturl, array('%' => '%%')) . '?action=trackip;searchip=%1$s">%1$s</a>',
'params' => array(
'member_ip' => false,
),
),]]></search>
<add><![CDATA['function' => create_function('$rowData', '
global $scripturl;
$url = strtr($scripturl, array(\'%\' => \'%%\')) . \'?action=trackip;searchip=\' . $rowData[\'member_ip\'];
return sprintfspamer($rowData, $url, \'member_ip\', 1);
'),]]></add>
</operation>
<!--- First List - List All Member - END --->

<!--- Second List - List Member Waiting Aproval - BEGIN --->
<operation>
<search position="replace"><![CDATA['sprintf' => array(
'format' => '<a href="' . strtr($scripturl, array('%' => '%%')) . '?action=profile;u=%1$d">%2$s</a>',
'params' => array(
'id_member' => false,
'member_name' => false,
),
),]]></search>
<add><![CDATA['function' => create_function('$rowData', '
global $scripturl;
$url = strtr($scripturl, array(\'%\' => \'%%\')) . \'?action=profile;u=\' . $rowData[\'id_member\'];
return sprintfspamer($rowData, $url, \'member_name\', 2);
'),]]></add>
</operation>

<operation>
<search position="replace"><![CDATA['sprintf' => array(
'format' => '<a href="mailto:%1$s">%1$s</a>',
'params' => array(
'email_address' => true,
),
),]]></search>
<add><![CDATA['function' => create_function('$rowData', '
global $scripturl;
$url = \'mailto:\' . $rowData[\'email_address\'];
return sprintfspamer($rowData, $url, \'email_address\', 3);
'),]]></add>
</operation>

<operation>
<search position="replace"><![CDATA['sprintf' => array(
'format' => '<a href="' . strtr($scripturl, array('%' => '%%')) . '?action=trackip;searchip=%1$s">%1$s</a>',
'params' => array(
'member_ip' => false,
),
),]]></search>
<add><![CDATA['function' => create_function('$rowData', '
global $scripturl;
$url = strtr($scripturl, array(\'%\' => \'%%\')) . \'?action=trackip;searchip=\' . $rowData[\'member_ip\'];
return sprintfspamer($rowData, $url, \'member_ip\', 1);
'),]]></add>
</operation>
<!--- Second List - List Member Waiting Aproval - END --->

<!--- Leyends, Info and  New Functions - BEGIN --->
<!--- Check or report inside ViewMemberlist() (sa = 'all' or 'query') - BEGIN --->
<operation>
<search position="after"><![CDATA[
// Are we performing a delete?]]></search>
<add><![CDATA[
// Are we performing a check or report?
if ((isset($_POST['spammers_checks']) || isset($_POST['spammers_report'])) && !empty($_POST['delete']))
{
checkSession();

// Clean the input.
foreach ($_POST['delete'] as $key => $value)
{
$_POST['delete'][$key] = (int) $value;
// Don't report yourself, idiot :P
if ($value == $user_info['id'] || '1' == $value)
unset($_POST['delete'][$key]);
}

$modSettings['registration_method'] = 2;

// Check and/or Report This Members
if (!empty($_POST['delete']))
checkreportMembers($_POST['delete'], isset($_POST['spammers_report']));
}
]]></add>
</operation>
<!--- Check or report inside ViewMemberlist() (sa = 'all' or 'query') - END --->

<!--- Check or report inside AdminApprove() (sa = 'approve') - BEGIN --->
<operation>
<search position="after"><![CDATA[
// We also need to the login languages here - for emails.]]></search>
<add><![CDATA[
// Are we performing a check or report?
if ((isset($_POST['spammers_checks']) || isset($_POST['spammers_report'])) && !empty($_POST['todoAction']))
{
checkSession();

// Clean the input.
foreach ($_POST['todoAction'] as $key => $value)
{
$_POST['delete'][$key] = (int) $value;
// Don't report yourself, idiot :P
if ($value == $user_info['id'] || '1' == $value)
unset($_POST['todoAction'][$key]);
}

$modSettings['registration_method'] = 2;

// Check and/or Report This Members
if (!empty($_POST['todoAction']))
checkreportMembers($_POST['todoAction'], isset($_POST['spammers_report']));
}
]]></add>
</operation>
<!--- Check or report inside AdminApprove() (sa = 'approve') - END --->

<operation>
<search position="after"><![CDATA[
array(
'position' => 'below_table_data',
'value' => '<input type="submit" ]]></search>
<add><![CDATA[
!$modSettings['stopspammer_enable'] ? '' :
array(
'position' => 'below_table_data',
'value' => '
<div style="text-align: center">' . $txt['stopspammer_count'] . ' : ' . $modSettings['stopspammer_count'] . '</div>',
'class' => 'titlebg',
),
!$modSettings['stopspammer_enable'] ? '' :
array(
'position' => 'below_table_data',
'value' => '
<div style="margin: auto" class="leyend_stopspammer">
<img src="' . $GLOBALS['settings']['default_images_url'] . '/icons/moreinfo.gif" alt="Icon MoreInfo" style="vertical-align: middle" /> ' . $txt['stopspammer_leyd01'] . '<br />
<img src="' . $GLOBALS['settings']['default_images_url'] . '/icons/suspect.gif" alt="Icon Suspect" style="vertical-align: middle" /> ' . $txt['stopspammer_leyd02'] . '<br />
<img src="' . $GLOBALS['settings']['default_images_url'] . '/icons/spammer.gif" alt="Icon Spammer" style="vertical-align: middle" /> ' . $txt['stopspammer_leyd03'] . '<br />
</div>',
'class' => 'titlebg',
),
!$modSettings['stopspammer_enable'] ? '' :
array(
'position' => 'below_table_data',
'value' => '
<label>' . $txt['in_stop_forum_spam'] . '</label>
<input type="submit" name="spammers_checks" value="' . $txt['spammers_checks'] . '" onclick="return confirm(\'' . $txt['confirm_spammers_checks'] . '\');" />
<input type="submit" name="spammers_report" value="' . $txt['spammers_report'] . '" onclick="return confirm(\'' . $txt['confirm_spammers_report'] . '\');" />',
'class' => 'titlebg','titlebg',
'style' => 'text-align: right;',
),]]></add>
</operation>

<operation>
<search position="after"><![CDATA[
array(
'position' => 'below_table_data',
'value' => '
[<a href="' . $scripturl . '?action=admin;area=viewmembers;sa=browse;showdupes=']]></search>
<add><![CDATA[
!$modSettings['stopspammer_enable'] ? '' :
array(
'position' => 'below_table_data',
'value' => '
<div style="text-align: center">' . $txt['stopspammer_count'] . ' : ' . $modSettings['stopspammer_count'] . '</div>',
'class' => 'titlebg',
),
!$modSettings['stopspammer_enable'] ? '' :
array(
'position' => 'below_table_data',
'value' => '
<div style="margin: auto" class="leyend_stopspammer">
<img src="' . $GLOBALS['settings']['default_images_url'] . '/icons/moreinfo.gif" alt="Icon MoreInfo" style="vertical-align: middle" /> ' . $txt['stopspammer_leyd01'] . '<br />
<img src="' . $GLOBALS['settings']['default_images_url'] . '/icons/suspect.gif" alt="Icon Suspect" style="vertical-align: middle" /> ' . $txt['stopspammer_leyd02'] . '<br />
<img src="' . $GLOBALS['settings']['default_images_url'] . '/icons/spammer.gif" alt="Icon Spammer" style="vertical-align: middle" /> ' . $txt['stopspammer_leyd03'] . '<br />
</div>',
'class' => 'titlebg',
),
!$modSettings['stopspammer_enable'] ? '' :
array(
'position' => 'below_table_data',
'value' => '
<label>' . $txt['in_stop_forum_spam'] . '</label>
<input type="submit" name="spammers_checks" value="' . $txt['spammers_checks'] . '" onclick="return confirm(\'' . $txt['confirm_spammers_checks'] . '\');" />
<input type="submit" name="spammers_report" value="' . $txt['spammers_report'] . '" onclick="return confirm(\'' . $txt['confirm_spammers_report'] . '\');" />',
'class' => 'titlebg','titlebg',
'style' => 'text-align: right;',
),]]></add>
</operation>

<operation>
<search position="replace"><![CDATA[if ($context['current_subaction'] == 'query' && !empty($_REQUEST['params']) && empty($_POST['types']))]]></search>
<add><![CDATA[if ($context['current_subaction'] == 'query' && !empty($_REQUEST['params']) && (empty($_POST['types']) || ((isset($_POST['spammers_checks']) || isset($_POST['spammers_report'])) && !empty($_POST['delete']))))]]></add>
</operation>
<!--- Leyends, Info and  New Functions - END --->
</file>

<file name="$sourcedir/Register.php">
<operation>
<search position="after"><![CDATA[
// Include the additional options that might have been filled in.]]></search>
<add><![CDATA[
// Is Spammer? Then should be approval
if ($modSettings['stopspammer_enable'])
{
require_once($sourcedir . '/StopSpammer.php');
if ($regOptions['spammer'] = checkDBSpammer($user_info['ip'], $_POST['user'], $_POST['email']))
{
$regOptions['require'] = 'approval';
$modSettings['registration_method'] = 2;
if ($regOptions['spammer'] != 8)
updateSettings(array('stopspammer_count' => ++$modSettings['stopspammer_count']), true);
}
}
]]></add>
</operation>
</file>

<file name="$sourcedir/Subs.php">
<operation>
<search position="replace"><![CDATA[$context['unapproved_members'] = !empty($modSettings['unapprovedMembers']) ? $modSettings['unapprovedMembers'] : 0;]]></search>
<add><![CDATA[$context['unapproved_members'] = $modSettings['unapprovedMembers'];]]></add>
</operation>
</file>

<file name="$sourcedir/Subs-Members.php">
<operation>
<search position="after"><![CDATA[
'validation_code' => $validation_code,]]></search>
<add><![CDATA[
'is_spammer' => empty($regOptions['spammer']) ? 0 : $regOptions['spammer'],]]></add>
</operation>

<operation>
<search position="replace"><![CDATA[mem.id_member, mem.member_name, mem.real_name, mem.email_address, mem.member_ip, mem.member_ip2, mem.last_login,]]></search>
<add><![CDATA[mem.id_member, mem.member_name, mem.real_name, mem.email_address, mem.member_ip, mem.member_ip2, mem.last_login, mem.is_spammer,]]></add>
</operation>
</file>

<file name="$sourcedir/Profile.php">
<!-- Profile BEGIN -->
<operation>
<search position="before"><![CDATA[ 'deleteaccount' => array(
'label' => $txt['deleteAccount'],
'file' => 'Profile-Actions.php',
'function' => 'deleteAccount',
'icon' => 'members_delete',
'sc' => 'post',
'token' => 'profile-da%u',
'password' => true,
'permission' => array(
'own' => array('profile_remove_any', 'profile_remove_own'),
'any' => array('profile_remove_any'),
),
),]]></search>
<add><![CDATA[
'checkmember' => array(
'label' => $txt['stopspammer_profilecheck'],
'custom_url' => $scripturl . '?action=admin;area=viewmembers;sa=query;params=' . base64_encode(serialize(array('mem_id' => $memID, 'types' => array('mem_id' => '=')))),
'enabled' => $cur_profile['id_group'] != 1 && !in_array(1, explode(',', $cur_profile['additional_groups'])),
'sc' => 'get',
'permission' => array(
'own' => array('profile_remove_any', 'profile_remove_own'),
'any' => array('profile_remove_any', 'moderate_forum'),
),
),]]></add>
</operation>
<!-- Profile END -->
</file>

</modification>


SD-X

Quote from: Scooter Trash on March 22, 2020, 12:24:46 AM
Quote from: SugarD-x on March 21, 2020, 10:24:52 PM
Quote from: Scooter Trash on March 21, 2020, 09:58:22 AM
QuoteHello, since SMF 2.1 is in RC2... do you plan to update this mod to make it working with 2.1?
I tried to install the mod, but I had a lot of errors... so I did not install it.

Same here. Tried to install on ver. 2.0.17 but got warning so abandoned installation. Unfortunate.
What errors did you get? It should be working fine on 2.0.x.

Execute Modification   ./Sources/ManageMembers.php    Test failed

Replace    ./Sources/ManageMembers.php    Test failed
Do you have any other mods installed?

Edit: I'm not sure if this is related to your issue or not, as I can't see what code you have failing from that information, but this post was mentioned previously for someone having a similar issue:
https://www.simplemachines.org/community/index.php?topic=283309.msg3957547#msg3957547

Scooter Trash

Quote from: SugarD-x on March 22, 2020, 10:51:18 AM

Edit: I'm not sure if this is related to your issue or not, as I can't see what code you have failing from that information, but this post was mentioned previously for someone having a similar issue:
https://www.simplemachines.org/community/index.php?topic=283309.msg3957547#msg3957547

httpBL
addon_OS_Browser_httpBL
and Ohara YouTube Embed.

I might try your suggestion when I have some time.
Thanks.

SD-X

Quote from: Scooter Trash on March 22, 2020, 07:59:33 PM
Quote from: SugarD-x on March 22, 2020, 10:51:18 AM

Edit: I'm not sure if this is related to your issue or not, as I can't see what code you have failing from that information, but this post was mentioned previously for someone having a similar issue:
https://www.simplemachines.org/community/index.php?topic=283309.msg3957547#msg3957547

httpBL
addon_OS_Browser_httpBL
and Ohara YouTube Embed.

I might try your suggestion when I have some time.
Thanks.
As far as I know, httpBL shouldn't have any conflicts with StopSpammer in the forum code, but the YouTube embed mod I don't know about personally.

Quote from: wylekk on March 22, 2020, 02:14:37 AM
Beautiful toy, all IP blocking manually in .htaccess, and this mod only finds registered users . Who wants to test the mod on SMF 2.1 RC2 here is an adapted file install_21.xml

<?xml version="1.0"?>
<!DOCTYPE modification SYSTEM "http://www.simplemachines.org/xml/modification">
<modification xmlns="http://www.simplemachines.org/xml/modification" xmlns:smf="http://www.simplemachines.org/">
<id>M-DVD:StopSpammer</id>
<name>Stop Spammer</name>
<version>2.3.9</version>

<file name="$sourcedir/ManageRegistration.php">
<operation>
<search position="before"><![CDATA[
require_once($sourcedir . '/ManageServer.php');
]]></search>
<add><![CDATA[
// Test if mod StopSpammer is OK
require_once($sourcedir . '/StopSpammer.php');
$txt['stopspammer_ok'] = stopspammer_test_mod_ok();
$stopspammer_faildb_sub = $txt['stopspammer_faildb_sub'];
]]></add>
</operation>

<operation>
<search position="before"><![CDATA[array('text', 'coppaPhone'),]]></search>
<add><![CDATA[
// Stop Spammer
array('title', 'stopspammer_settings'),
$txt['stopspammer_ok'],
'',
array('check', 'stopspammer_enable', 'subtext' => $txt['stopspammer_enable_sub']),
array('desc', 'stopspammer_check_sub1'),
array('check', 'stopspammer_check_name'),
array('check', 'stopspammer_check_mail'),
array('check', 'stopspammer_check_ip'),
array('desc', 'stopspammer_check_sub2'),
array('select', 'stopspammer_faildb', array($txt['stopspammer_fail01'], $txt['stopspammer_fail02'], $txt['stopspammer_fail03']), 'subtext' => $stopspammer_faildb_sub),
array('check', 'stopspammer_show01', 'subtext' => $txt['stopspammer_show01_sub']),
array('text', 'stopspammer_api_key'),
array('desc', 'stopspammer_api_key_sub'),]]></add>
</operation>
</file>

<file name="$sourcedir/ManageMembers.php">
<!--- Load our functions at the beginning of ViewMembers() for every sa we need --->
<operation>
<search position="before"><![CDATA['query' => array('ViewMemberlist', 'moderate_forum'),
);]]></search>
<add><![CDATA[$_REQUEST['sa'] = isset($_REQUEST['sa']) && isset($subActions[$_REQUEST['sa']]) ? $_REQUEST['sa'] : 'all';
// Load Stop Spammer Functions
if ('all' == $_REQUEST['sa'] || 'browse' == $_REQUEST['sa'] || 'query' == $_REQUEST['sa'] || 'approve' == $_REQUEST['sa'])
{
global $sourcedir;
require_once($sourcedir . '/StopSpammer.php');
}]]></add>
</operation>

<!--- First List - List All Member - BEGIN --->
<operation>
<search position="replace"><![CDATA['sprintf' => array(
'format' => '<a href="' . strtr($scripturl, array('%' => '%%')) . '?action=profile;u=%1$d">%2$s</a>',
'params' => array(
'id_member' => false,
'member_name' => false,
),
),]]></search>
<add><![CDATA['function' => create_function('$rowData', '
global $scripturl;
$url = strtr($scripturl, array(\'%\' => \'%%\')) . \'?action=profile;u=\' . $rowData[\'id_member\'];
return sprintfspamer($rowData, $url, \'member_name\', 2);
'),]]></add>
</operation>

<operation>
<search position="replace"><![CDATA['sprintf' => array(
'format' => '<a href="' . strtr($scripturl, array('%' => '%%')) . '?action=profile;u=%1$d">%2$s</a>',
'params' => array(
'id_member' => false,
'real_name' => false,
),
),]]></search>
<add><![CDATA['function' => create_function('$rowData', '
global $scripturl;
$url = strtr($scripturl, array(\'%\' => \'%%\')) . \'?action=profile;u=\' . $rowData[\'id_member\'];
return sprintfspamer($rowData, $url, \'real_name\', 0);
'),]]></add>
</operation>

<operation>
<search position="replace"><![CDATA['sprintf' => array(
'format' => '<a href="mailto:%1$s">%1$s</a>',
'params' => array(
'email_address' => true,
),
),]]></search>
<add><![CDATA['function' => create_function('$rowData', '
global $scripturl;
$url = \'mailto:\' . $rowData[\'email_address\'];
return sprintfspamer($rowData, $url, \'email_address\', 3);
'),]]></add>
</operation>

<operation>
<search position="replace"><![CDATA['sprintf' => array(
'format' => '<a href="' . strtr($scripturl, array('%' => '%%')) . '?action=trackip;searchip=%1$s">%1$s</a>',
'params' => array(
'member_ip' => false,
),
),]]></search>
<add><![CDATA['function' => create_function('$rowData', '
global $scripturl;
$url = strtr($scripturl, array(\'%\' => \'%%\')) . \'?action=trackip;searchip=\' . $rowData[\'member_ip\'];
return sprintfspamer($rowData, $url, \'member_ip\', 1);
'),]]></add>
</operation>
<!--- First List - List All Member - END --->

<!--- Second List - List Member Waiting Aproval - BEGIN --->
<operation>
<search position="replace"><![CDATA['sprintf' => array(
'format' => '<a href="' . strtr($scripturl, array('%' => '%%')) . '?action=profile;u=%1$d">%2$s</a>',
'params' => array(
'id_member' => false,
'member_name' => false,
),
),]]></search>
<add><![CDATA['function' => create_function('$rowData', '
global $scripturl;
$url = strtr($scripturl, array(\'%\' => \'%%\')) . \'?action=profile;u=\' . $rowData[\'id_member\'];
return sprintfspamer($rowData, $url, \'member_name\', 2);
'),]]></add>
</operation>

<operation>
<search position="replace"><![CDATA['sprintf' => array(
'format' => '<a href="mailto:%1$s">%1$s</a>',
'params' => array(
'email_address' => true,
),
),]]></search>
<add><![CDATA['function' => create_function('$rowData', '
global $scripturl;
$url = \'mailto:\' . $rowData[\'email_address\'];
return sprintfspamer($rowData, $url, \'email_address\', 3);
'),]]></add>
</operation>

<operation>
<search position="replace"><![CDATA['sprintf' => array(
'format' => '<a href="' . strtr($scripturl, array('%' => '%%')) . '?action=trackip;searchip=%1$s">%1$s</a>',
'params' => array(
'member_ip' => false,
),
),]]></search>
<add><![CDATA['function' => create_function('$rowData', '
global $scripturl;
$url = strtr($scripturl, array(\'%\' => \'%%\')) . \'?action=trackip;searchip=\' . $rowData[\'member_ip\'];
return sprintfspamer($rowData, $url, \'member_ip\', 1);
'),]]></add>
</operation>
<!--- Second List - List Member Waiting Aproval - END --->

<!--- Leyends, Info and  New Functions - BEGIN --->
<!--- Check or report inside ViewMemberlist() (sa = 'all' or 'query') - BEGIN --->
<operation>
<search position="after"><![CDATA[
// Are we performing a delete?]]></search>
<add><![CDATA[
// Are we performing a check or report?
if ((isset($_POST['spammers_checks']) || isset($_POST['spammers_report'])) && !empty($_POST['delete']))
{
checkSession();

// Clean the input.
foreach ($_POST['delete'] as $key => $value)
{
$_POST['delete'][$key] = (int) $value;
// Don't report yourself, idiot :P
if ($value == $user_info['id'] || '1' == $value)
unset($_POST['delete'][$key]);
}

$modSettings['registration_method'] = 2;

// Check and/or Report This Members
if (!empty($_POST['delete']))
checkreportMembers($_POST['delete'], isset($_POST['spammers_report']));
}
]]></add>
</operation>
<!--- Check or report inside ViewMemberlist() (sa = 'all' or 'query') - END --->

<!--- Check or report inside AdminApprove() (sa = 'approve') - BEGIN --->
<operation>
<search position="after"><![CDATA[
// We also need to the login languages here - for emails.]]></search>
<add><![CDATA[
// Are we performing a check or report?
if ((isset($_POST['spammers_checks']) || isset($_POST['spammers_report'])) && !empty($_POST['todoAction']))
{
checkSession();

// Clean the input.
foreach ($_POST['todoAction'] as $key => $value)
{
$_POST['delete'][$key] = (int) $value;
// Don't report yourself, idiot :P
if ($value == $user_info['id'] || '1' == $value)
unset($_POST['todoAction'][$key]);
}

$modSettings['registration_method'] = 2;

// Check and/or Report This Members
if (!empty($_POST['todoAction']))
checkreportMembers($_POST['todoAction'], isset($_POST['spammers_report']));
}
]]></add>
</operation>
<!--- Check or report inside AdminApprove() (sa = 'approve') - END --->

<operation>
<search position="after"><![CDATA[
array(
'position' => 'below_table_data',
'value' => '<input type="submit" ]]></search>
<add><![CDATA[
!$modSettings['stopspammer_enable'] ? '' :
array(
'position' => 'below_table_data',
'value' => '
<div style="text-align: center">' . $txt['stopspammer_count'] . ' : ' . $modSettings['stopspammer_count'] . '</div>',
'class' => 'titlebg',
),
!$modSettings['stopspammer_enable'] ? '' :
array(
'position' => 'below_table_data',
'value' => '
<div style="margin: auto" class="leyend_stopspammer">
<img src="' . $GLOBALS['settings']['default_images_url'] . '/icons/moreinfo.gif" alt="Icon MoreInfo" style="vertical-align: middle" /> ' . $txt['stopspammer_leyd01'] . '<br />
<img src="' . $GLOBALS['settings']['default_images_url'] . '/icons/suspect.gif" alt="Icon Suspect" style="vertical-align: middle" /> ' . $txt['stopspammer_leyd02'] . '<br />
<img src="' . $GLOBALS['settings']['default_images_url'] . '/icons/spammer.gif" alt="Icon Spammer" style="vertical-align: middle" /> ' . $txt['stopspammer_leyd03'] . '<br />
</div>',
'class' => 'titlebg',
),
!$modSettings['stopspammer_enable'] ? '' :
array(
'position' => 'below_table_data',
'value' => '
<label>' . $txt['in_stop_forum_spam'] . '</label>
<input type="submit" name="spammers_checks" value="' . $txt['spammers_checks'] . '" onclick="return confirm(\'' . $txt['confirm_spammers_checks'] . '\');" />
<input type="submit" name="spammers_report" value="' . $txt['spammers_report'] . '" onclick="return confirm(\'' . $txt['confirm_spammers_report'] . '\');" />',
'class' => 'titlebg','titlebg',
'style' => 'text-align: right;',
),]]></add>
</operation>

<operation>
<search position="after"><![CDATA[
array(
'position' => 'below_table_data',
'value' => '
[<a href="' . $scripturl . '?action=admin;area=viewmembers;sa=browse;showdupes=']]></search>
<add><![CDATA[
!$modSettings['stopspammer_enable'] ? '' :
array(
'position' => 'below_table_data',
'value' => '
<div style="text-align: center">' . $txt['stopspammer_count'] . ' : ' . $modSettings['stopspammer_count'] . '</div>',
'class' => 'titlebg',
),
!$modSettings['stopspammer_enable'] ? '' :
array(
'position' => 'below_table_data',
'value' => '
<div style="margin: auto" class="leyend_stopspammer">
<img src="' . $GLOBALS['settings']['default_images_url'] . '/icons/moreinfo.gif" alt="Icon MoreInfo" style="vertical-align: middle" /> ' . $txt['stopspammer_leyd01'] . '<br />
<img src="' . $GLOBALS['settings']['default_images_url'] . '/icons/suspect.gif" alt="Icon Suspect" style="vertical-align: middle" /> ' . $txt['stopspammer_leyd02'] . '<br />
<img src="' . $GLOBALS['settings']['default_images_url'] . '/icons/spammer.gif" alt="Icon Spammer" style="vertical-align: middle" /> ' . $txt['stopspammer_leyd03'] . '<br />
</div>',
'class' => 'titlebg',
),
!$modSettings['stopspammer_enable'] ? '' :
array(
'position' => 'below_table_data',
'value' => '
<label>' . $txt['in_stop_forum_spam'] . '</label>
<input type="submit" name="spammers_checks" value="' . $txt['spammers_checks'] . '" onclick="return confirm(\'' . $txt['confirm_spammers_checks'] . '\');" />
<input type="submit" name="spammers_report" value="' . $txt['spammers_report'] . '" onclick="return confirm(\'' . $txt['confirm_spammers_report'] . '\');" />',
'class' => 'titlebg','titlebg',
'style' => 'text-align: right;',
),]]></add>
</operation>

<operation>
<search position="replace"><![CDATA[if ($context['current_subaction'] == 'query' && !empty($_REQUEST['params']) && empty($_POST['types']))]]></search>
<add><![CDATA[if ($context['current_subaction'] == 'query' && !empty($_REQUEST['params']) && (empty($_POST['types']) || ((isset($_POST['spammers_checks']) || isset($_POST['spammers_report'])) && !empty($_POST['delete']))))]]></add>
</operation>
<!--- Leyends, Info and  New Functions - END --->
</file>

<file name="$sourcedir/Register.php">
<operation>
<search position="after"><![CDATA[
// Include the additional options that might have been filled in.]]></search>
<add><![CDATA[
// Is Spammer? Then should be approval
if ($modSettings['stopspammer_enable'])
{
require_once($sourcedir . '/StopSpammer.php');
if ($regOptions['spammer'] = checkDBSpammer($user_info['ip'], $_POST['user'], $_POST['email']))
{
$regOptions['require'] = 'approval';
$modSettings['registration_method'] = 2;
if ($regOptions['spammer'] != 8)
updateSettings(array('stopspammer_count' => ++$modSettings['stopspammer_count']), true);
}
}
]]></add>
</operation>
</file>

<file name="$sourcedir/Subs.php">
<operation>
<search position="replace"><![CDATA[$context['unapproved_members'] = !empty($modSettings['unapprovedMembers']) ? $modSettings['unapprovedMembers'] : 0;]]></search>
<add><![CDATA[$context['unapproved_members'] = $modSettings['unapprovedMembers'];]]></add>
</operation>
</file>

<file name="$sourcedir/Subs-Members.php">
<operation>
<search position="after"><![CDATA[
'validation_code' => $validation_code,]]></search>
<add><![CDATA[
'is_spammer' => empty($regOptions['spammer']) ? 0 : $regOptions['spammer'],]]></add>
</operation>

<operation>
<search position="replace"><![CDATA[mem.id_member, mem.member_name, mem.real_name, mem.email_address, mem.member_ip, mem.member_ip2, mem.last_login,]]></search>
<add><![CDATA[mem.id_member, mem.member_name, mem.real_name, mem.email_address, mem.member_ip, mem.member_ip2, mem.last_login, mem.is_spammer,]]></add>
</operation>
</file>

<file name="$sourcedir/Profile.php">
<!-- Profile BEGIN -->
<operation>
<search position="before"><![CDATA[ 'deleteaccount' => array(
'label' => $txt['deleteAccount'],
'file' => 'Profile-Actions.php',
'function' => 'deleteAccount',
'icon' => 'members_delete',
'sc' => 'post',
'token' => 'profile-da%u',
'password' => true,
'permission' => array(
'own' => array('profile_remove_any', 'profile_remove_own'),
'any' => array('profile_remove_any'),
),
),]]></search>
<add><![CDATA[
'checkmember' => array(
'label' => $txt['stopspammer_profilecheck'],
'custom_url' => $scripturl . '?action=admin;area=viewmembers;sa=query;params=' . base64_encode(serialize(array('mem_id' => $memID, 'types' => array('mem_id' => '=')))),
'enabled' => $cur_profile['id_group'] != 1 && !in_array(1, explode(',', $cur_profile['additional_groups'])),
'sc' => 'get',
'permission' => array(
'own' => array('profile_remove_any', 'profile_remove_own'),
'any' => array('profile_remove_any', 'moderate_forum'),
),
),]]></add>
</operation>
<!-- Profile END -->
</file>

</modification>

Which versions of 2.1 has this been tested on so far?

wylekk

the same version is specified there -smf2.1rc2,  installed on my work site.


SD-X

Quote from: wylekk on March 23, 2020, 04:35:48 AM
the same version is specified there -smf2.1rc2,  installed on my work site.
Oops, my mistake! I don't know how I missed that.

viulian

Works for me on 2.0.17 version ... after manually fixing the code during updates and adding the IFs back.

Had to change the 'www' to 'api' and '.com' to '.org' in StopSpammer.php (_except_ for the /add URL, the one for Reporting the users).

EL34

I have been using this mod for many years  :)
Current forum version is 2.0.17

Note that all membership request must be approved by me first
And so I have to view the list of want to be members first

I get spammer request all the time
Sometimes as many as 8 overnight

It waste my time to have to manually reject the ones that are already know to be spammers
One feature I would really like to see is the ability to just reject forum membership request if IP and email are found in the database

For an example, look at my screen shot
This is a perfect example of what I would like to be rejected automatically

Not sure if this can be done or if the author is still updating this mod?
Thanks


Forum History -> EZBoard -> YABB -> SMF 1.1.19 -> SMF 2.0.19

Kindred

Add good questions and you will cut down on the number of spammers that even get to the point of needing approval by 90%
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Advertisement: