Pornographic referrals
Posted Apr 12, 2004 in PHP.
Recently, I have been getting many referrals from pornographic sites. I think I have traced the source of this back to a Geocities user called bluegirl who posted a comment on one of my entries. Because I graciously provide the opportunity to include a URI to a user's site, she was able to link back to her website - I will not link to it directly, but it is http://geocities.com/episodesusdbz/ - where links to my site, and others can be found. Somehow, being linked on her site got me linked on many pornographic sites, as a source of pornographic images, etc.
I have therefore been forced to include some sort of filtering in my hand-rolled referral system. It isn't pretty, but the code boils down to this:
if(stristr($referer,"jessey") ||
stristr($referer,"fistbang") ||
stristr($referer,"skipme") ||
stristr($referer,"episodesusdbz") ||
stristr($referer,"tartanweek") ||
stristr($referer,"shatteredreality") ||
stristr($referer,"bloglines") ||
stristr($referer,"porn") ||
stristr($referer,"amateurxpass") ||
stristr($referer,"nude") ||
stristr($referer,"anal") ||
stristr($referer,"thebestofnet")) {
} else {
if(!$referer == "") {
mysql_query($query, $link) or die ("Couldn't add referral data: " . mysql_error());
}
}
I am sure this is a horrid way of doing this, but it works. I am hoping that someone will be able to suggest a more optimized approach. It saddens me that this kind of thing is necessary at all, but I see no alternative. I like providing a referral page for my guests, as a way of thanking them for linking to me. It seems only fair.


Comments
An array with those strings, an if statement in a loop that sets a boolean if true. That's all you need I suppose :).
Posted by coubertin119 on Apr 13, 2004.
Yeah, that's a good idea. Then I can add database support to it. I'll have to give that a little thought.
Posted by Simon Jessey on Apr 13, 2004.