The forum of the forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.

potential code for stopping spam?

3 posters

Go down

potential code for stopping spam? Empty potential code for stopping spam?

Post by koimaster November 23rd 2011, 6:46 am

In Sources/Register.php after

Code: [Select]
// Set the options needed for registration.
You could add something like this:

Code: [Select]
//SPAM CHECK
function doBanAdd(){
include_once('Sources/ManageBans.php');
$_REQUEST['bg'] = 10; //Set this to whatever ban you want to use.
$_POST['add_new_trigger']='Add';
$_POST['HBan']="YourCustomKeyHERE";
BanEdit();
}

isBannedEmail($_POST['email'], 'cannot_register', 'Sorry, you are not allowed to register on this forum.');

if(isset($_SERVER['HTTP_X_FORWARD_FOR'])) {
$ip = $_SERVER['HTTP_X_FORWARD_FOR'];
} else {
$ip = $_SERVER['REMOTE_ADDR'];
}

$xml_string = file_get_contents('http://www.stopforumspam.com/api?email='.$_POST['email']);
$xml = new SimpleXMLElement($xml_string);
if($xml->appears == 'yes')
{
$_POST['bantype'] = 'email_ban';
doBanAdd();
}
else
{
$xml_string = file_get_contents('http://www.stopforumspam.com/api?ip='.$ip);
$xml = new SimpleXMLElement($xml_string);
if($xml->appears == 'yes')
{
$_POST['bantype'] = 'ip_ban';
$_POST['ip']=$ip;
doBanAdd();
}
}
//END SPAM CHECK


Then in Sources/ManageBans.php
Find:

Code: [Select]
if (!empty($_POST['add_new_trigger']) || !empty($_POST['edit_trigger']))
{
checkSession();

And replace with:

Code: [Select]
if (!empty($_POST['add_new_trigger']) || !empty($_POST['edit_trigger']))
{
if(!isset($_POST['HBan']) || $_POST['HBan']!=="YourCustomKeyHERE")checkSession();

Then find:

Code: [Select]
$context['sub_template'] = 'ban_edit';

Replace with:

Code: [Select]
if(!isset($_POST['HBan']) || $_POST['HBan']!=="YourCustomKeyHERE")$context['sub_template'] = 'ban_edit';




remember to replace "YourCustomKeyHERE" with a secret key.
koimaster
koimaster
Forumember

Male Posts : 162
Reputation : 0
Language : english
Location : Oregon

http://watchlords.forumotion.net/

Back to top Go down

potential code for stopping spam? Empty Re: potential code for stopping spam?

Post by Guest November 23rd 2011, 1:32 pm

Sorry, but PHP or SQL files doesn't work on forumotion. Anyway, you can suggest it here - https://help.forumotion.com/f30-suggestions-for-your-forums Wink
avatar
Guest
Guest


Back to top Go down

potential code for stopping spam? Empty Re: potential code for stopping spam?

Post by LGforum November 23rd 2011, 1:40 pm

Forumotion will never (99.9% sure) allow PHP scripts.
LGforum
LGforum
Hyperactive

Male Posts : 2265
Reputation : 264
Language : English
Location : UK

Back to top Go down

potential code for stopping spam? Empty Re: potential code for stopping spam?

Post by ShinyTwinky69 November 23rd 2011, 3:03 pm

LGforum just to add something, they is many resaons why it won't be allowed, and that includes abuse.
avatar
ShinyTwinky69
Forumember

Male Posts : 35
Reputation : 1
Language : English/Spanish
Location : El Paso, Texas, United States

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum