FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Prevent Website from Bad Referrers / Porn Sites





ankurthakur
Hello Guyz,

I wanted to Share this with you so I am posting it here Smile

Here is a simple PHP Script which will allow you to prevent your Website from Bad referrers and Porn sites etc. You can simply Add this Code into any PHP File to prevent that file from bad referrers.

Code :
Code:
$badwords = array('viagra','anal','gangbang');
if (isset($_SERVER['HTTP_REFERER']))
{
   foreach($badwords as $word)
   {
      if(preg_match("/".$word."/", $_SERVER['HTTP_REFERER']))
      {
         header("Location: http://english-1325580600.spampoison.com");
      }
   }
}

As you can see, there is an Array of Bad words, in which you can Add manually more words :
Code:
$badwords = array('viagra','anal','gangbang');


[ Read the Full Article and CMS Implementation here ]

Thank You

Regards,
Ankur Smile
Hogwarts
Why would you want such a script? Confused
ankurthakur
Hogwarts wrote:
Why would you want such a script? Confused

Because in the Recent months, the quantity of Spam is increased a lot on the Internet.

And doing this, we can help each other by Decreasing Spam on our website.

I've seen on some websites where Spammers have posted about viagra etc and have linked that Content to my website. In that case, Intelligent Bots like Google take it in their notice and it makes the website image bad on Search Engines. Similarly, on our site, they spam others and so on.

So it is something which is doing Good for everyone of us...

I guess that you haven't faced a Spam attack yet... Razz I had one attack about 3-4 months ago and they just suddenly filled my whole website with their Spams...

So that is why there is a need Cool
Hogwarts
ankurthakur wrote:
I guess that you haven't faced a Spam attack yet... Razz I had on e attack about 3-4 months ago and they just suddenly filled my whole website with their Spams...

So that is why there is a need Cool


Honestly I have; and that's why I use recaptcha and akismet where appropriate (two significantly more effective and sophisticated ways at preventing spam)
ankurthakur
Hogwarts wrote:
ankurthakur wrote:
I guess that you haven't faced a Spam attack yet... Razz I had on e attack about 3-4 months ago and they just suddenly filled my whole website with their Spams...

So that is why there is a need Cool


Honestly I have; and that's why I use recaptcha and akismet where appropriate (two significantly more effective and sophisticated ways at preventing spam)


Good. Then it will be helpful for those who don't use those services Wink
Hogwarts
ankurthakur wrote:
Good. Then it will be helpful for those who don't use those services Wink


Do you have any non-anecdotal evidence to suggest that your method of prevention is working?

Why are you not filtering the content each user posts instead? i.e. blocking a post if it contains these terms. It's a simpler, faster, and generally more efficient method of dealing with spam. I honestly don't think the script you've posted will have any tangible impact on spam on your website.

And even with that considered, having a captcha (recaptcha being a free service provided by google) at registration should not inconvenience anybody more than a few seconds and is a proven solution. Why would you go out of your way to avoid implementing one if you were having issues with spam?
ankurthakur
I dont know. I have secured my website by implementing much Two ways Captcha verification and its good.

But this is to prevent Spammers from entering websites. The Google Captcha and the securimage were failed a couple of months ago when there was a Huge attack on websites(one was mine) with the same E-Mail which spammers used even when websites were using Captchas.

So I think that this can be a Good alternative for atleast protecting your site.

However, if my website is referred by some website which contains those words in URL, it will be redirected to Spammers Trap or spam poison website.
sonam
How I know $_SERVER['HTTP_REFERER'] can simple be blocked and changed with any proxy or some other ways. BTW if I am one ordinary visitor on some porn site and then come from this site on your site how you know am I am spammer or not? Coming from some site on your site is not relevant measure to call someone spammer.

Sonam
Hogwarts
sonam wrote:
How I know $_SERVER['HTTP_REFERER'] can simple be blocked and changed with any proxy or some other ways


It's trivial to not send or manipulate that header
ankurthakur
sonam wrote:
How I know $_SERVER['HTTP_REFERER'] can simple be blocked and changed with any proxy or some other ways. BTW if I am one ordinary visitor on some porn site and then come from this site on your site how you know am I am spammer or not? Coming from some site on your site is not relevant measure to call someone spammer.

Sonam


Be a little Logical... please.

No webmaster will be happy to look its page link on a porn website... Confused But if it is, and the user clicked, then it will be redirected as it will seem a spammer who spams for porn, viagra etc...

This is a very small handy snippet. This will block bad referrers or from Porn websites. You may use captcha verification to prevent Spam while registration.
sonam
ankurthakur wrote:

No webmaster will be happy to look its page link on a porn website... Confused


This snippet can redirect (if is not fake header in a game) some users but cannot stop owner of porn site to insert your link on their pages. In that case all search engines will know how is your site linked from porn sites. The users of porn site will see your link. And on the end only you will loose information are your site linked on porn site or not.

BTW if I am spammer and link not working or redirect me to some other site I can easily copy paste a tag and insert in URL bar. In that case your snippet don't work.

Hogwarts wrote:
It's trivial to not send or manipulate that header

I will do that if I will own porn site Twisted Evil

Sonam
codersfriend
ever tried integrating akismet? it's a very good spam blocker
Related topics
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.