PDA

View Full Version : Advice Needed To Stop Spam


idzone
June 10th, 2007, 10:46 PM
I have installed the m2scripts.com poll script on my website. Since last few days, spammers are creating bogus polls and posting them. In the poll introduction, there are 'http' links posted. Also in the poll options - option 1, 2...., there are blatant spam http links posted. I remove all of these every day, via phpmyadmin, but I want to stop this spam.

They are posting plain http links or sometimes with <a href tags and these become live links after posting.

Q1. Is there any way to disable links from the polls?
Q2. Any way of finding the IPs and banning them from the site?
Q3. Any other suggestion?

I do not wish to post my website link here. The m2scripts poll script is fairly common and I hope someone can help.

I did contact john at m2scripts, but he wasn't able to give me a solution.

myspaceprodesigns
June 11th, 2007, 03:36 PM
1. you can use strip_tags on the form validator and it'll get rid of all html for you

2. you can add a captcha

3. you can add $_SERVER['REMOTE_ADDR']; to your form validator and save it to a text file with a poll id so you know the IP of the creator of the poll.

marshall_26
June 11th, 2007, 11:11 PM
Something to the effect of,



preg_match('/http/i', $var, $matched);

if($matched ==TRUE){
echo "links not allowed!";
exit;
}else{
strip_tags($var);
}



of course you'll need to find which variable to check it against :) not firmilir with the script myself.

idzone
June 11th, 2007, 11:53 PM
Something to the effect of,



preg_match('/http/i', $var, $matched);

if($matched ==TRUE){
echo "links not allowed!";
exit;
}else{
strip_tags($var);
}



of course you'll need to find which variable to check it against :) not firmilir with the script myself.

Thanks for replying, both of you.
Marshall: Where do I put this code?

marshall_26
June 12th, 2007, 12:12 AM
Thanks for replying, both of you.
Marshall: Where do I put this code?

Really this is more of a generic example I'd need to see your script to know what variable needs to be checked. Kind of working blind with it here :)

idzone
June 12th, 2007, 12:15 AM
Thanks. I will contact you on pm.

marshall_26
June 12th, 2007, 02:18 PM
Thanks. I will contact you on pm.

idzone, I got it done!

Check your email.

for anyone else add the following under

include("config.php");

in poll.php

if($_POST){

$matched = 0;

for ($i = 1; $i <= 10; $i++){

$stranswer = $_POST["answer$i"];
if(preg_match('/(?:http:\/\/)?(?:[\w-]+\.)+[a-z]{2,6}/i', $stranswer)){$matched++;};
}

$strquestion = $_POST["question"];
$strintro = $_POST["intro"];
$strtitle = $_POST["title"];

if(preg_match('/(?:http:\/\/)?(?:[\w-]+\.)+[a-z]{2,6}/i', $strquestion)){$matched++;}
if(preg_match('/(?:http:\/\/)?(?:[\w-]+\.)+[a-z]{2,6}/i', $strintro)){$matched++;}
if(preg_match('/(?:http:\/\/)?(?:[\w-]+\.)+[a-z]{2,6}/i', $strtitle)){$matched++;}

if($matched !=0){
echo "Please remove the URL!";
exit;
}
}

idzone
June 12th, 2007, 09:50 PM
Thank you very much. I will implement this new change. By the way, even with yesterday's script, there have been no spam polls at all. Thanks a lot.

marshall_26
June 12th, 2007, 10:23 PM
Thank you very much. I will implement this new change. By the way, even with yesterday's script, there have been no spam polls at all. Thanks a lot.

Your welcome :)