scriptygoddess

12 Apr, 2002

Little Green Footballs Referrer Script…

Posted by: Jennifer In: How to's

Most people have found Little Green Footballs referrer script. (I've implemented it here as well).

Here's a tip if you want to have it ignore another referrer… For example, there's a bot that's been crawling my blog (and a few other people's as well). It'll show up on the referrer list as every other entry (kind of annoying).

So here's a tip on how to add a referrer on the ignore list.

Open the lgf-reflog.php that comes with the referrer script.

ADD this line UNDER the $mydomain thingy:
$bot1 = 'TheReferrer.Thats.been.hitting.Your.Site';

Then change this line
if (($ref) and (!strstr($ref, $mydomain))) {

To this:
if (($ref) and (!strstr($ref, $mydomain)) and (!strstr($ref,$bot1)) ) {

easy peasy.

11 Responses to "Little Green Footballs Referrer Script…"

1 | kristine

April 18th, 2002 at 5:54 am

Avatar

Jennifer – I'm getting the same bot, but not in all my pages; how odd!
Can I use an http:// address or do I need to find an IP address? And if I use an IP address, how do I make sure I'm not blocking everyone on our host from showing up?
Thanks bunches!

2 | Lynda

April 18th, 2002 at 7:06 am

Avatar

I'm pretty sure it's the http:// address. I haven't looked at the script, but it's probably pulling in the referring address, so that's what would need to be blocked.

:)

3 | Jennifer

April 18th, 2002 at 7:51 am

Avatar

actually, no… don't put the "http://" thing there. You can copy the line right out of that referrer list, and just put everything AFTER http://

That won't block everyone from our host.

Let me know if you have any more questions…

4 | Jennifer

April 18th, 2002 at 7:52 am

Avatar

Also – if you're getting more than one bot – you can ignore more than one bot at a time:

just do this:

$bot1 = 'themis.hmdns.net:2086/scripts/command';
$bot2 = 'whatever';
$bot3 = 'whatever';
Etc. etc

Then on this line
if (($ref) and (!strstr($ref, $mydomain)) and (!strstr($ref,$bot1)) ) {
just keep adding: and (!strstr($ref,$bot2)) and (!strstr($ref,$bot3))

Etc. before that last ") {"

So for 3 bots the line would look like:
if (($ref) and (!strstr($ref, $mydomain)) and (!strstr($ref,$bot1)) and (!strstr($ref,$bot2)) and (!strstr($ref,$bot3)) ) {

5 | kristine

April 18th, 2002 at 4:42 pm

Avatar

Thanks! Now we'll see if I can get back to normal instead of having themis hitting me every other time!!! :)

6 | Ron

March 14th, 2003 at 5:28 pm

Avatar

I added this function to lgf-reflog.php to handle filtering bad referrers.

function isBadReferrer($ref)
{
if (
(strstr($ref, $mydomain)) or
(strstr($ref, "google.pl")) or
(strstr($ref, "google.fl")) or
(strstr($ref, "google.com")) or
(strstr($ref, "search.yahoo.com"))
)
{
return true;
}
else
{
return false;
}
}

then I changed the line

if (($ref) and (!isBadReferrer($ref) ))

to

if (($ref) and (!isBadReferrer($ref) ))

An improvement would be to read a list of bad referrers from a text file into an array and iterate the array in this function. If you did that you could avoid changing code every time you want to add to the list.

7 | Jennifer

March 15th, 2003 at 9:59 am

Avatar

Ooh that would probably be useful here as well. Thanks Ron!

8 | Mike

October 12th, 2003 at 9:42 pm

Avatar

Hi,

I tried a couple of those php script examples here to block referrers but they don't work on my site at all.
I thought about it a bit and think it's the frames and the welcome_intro.php file is kicked up by the index.html along with the left frame left.html

So Am I right to think the php script is seeing as the referrer the index.html not the bad referrer and that's why nothing happens?
I don't see a way to work that unless I rename index.html to index.php but then not having the index.html file will just show all the files in the directory.

I had a problem with some idiots hotlinking my logos and graphics, fixed that as well as banned a number of ip's, but it seems there are several referrers linking to my site sending unwanted traffic I want to kill, one is ;

web.ask.com

I contacted Jeeves and asked they remove the link in their search since it was hitting my State law map in searches for animal porn. I finally got fed up with the Jeeves' lack of response and I stuck a nifty script to open 8 new browser windows right back at them and also the fbi, cia, NYC police dept and other web sites :)

There is a second file ask.com keeps referring these unwanted hits to, so I used the same script to open 6 new windows back at jeeves and told them if the link to my site isn't removed I'll add 6 more open new windows to that script every week.

Any ideas for a fix to block referrers with a frames site that has an index.html page that activates the main page and sidebar?

I only see changing the index.html to index.php but then all the files will display in list form.

Former webmaster used bad meta tags and as a result the site gets a lot of incorrect hits, I am trying to correct that (removed all the bad meta tags) and transferring files to another animal welfare group soo, so right now it's just a skeleton site and eventually will just be a php message forum with links to the other groups.

But I'd like to clean things up before I give them the traffic.

9 | Tim G

November 22nd, 2003 at 4:36 pm

Avatar

I am getting lots of pron spam in my referrer log…I know they have some illegitimate way to get in the log, ie. they don't really load the page.

Any ideas how to kill it, as it comes from everywhere and links to hundreds of different sites?

10 | jackiefg

March 3rd, 2004 at 6:37 pm

Avatar

I've implemented your code in my lgf file and put in about 33 of the stupid p0rn sites that keeps pinging me or something, but since they're always changing the name, I'm wondering if there's a way to have it read just words (words that are in the referring url) instead of the entire urls?

11 | Zi

August 13th, 2004 at 8:51 pm

Avatar

I've been having a horrible time with those dirty sites showing up on my referrer list. For some reason the $bot hack stopped working after I reached about 30. Maybe they're just a new breed of bots but they seem to be getting harder to get rid of. I'm going to try out that bad referrer hack that Ron suggested, thanks for the help! :) If anyone finds a way to get rid of all these sites for good please let me know.

Featured Sponsors

Genesis Framework for WordPress

Advertise Here


  • Scott: Just moved changed the site URL as WP's installed in a subfolder. Cookie clearance worked for me. Thanks!
  • Stephen Lareau: Hi great blog thanks. Just thought I would add that it helps to put target = like this:1-800-555-1212 and
  • Cord Blomquist: Jennifer, you may want to check out tp2wp.com, a new service my company just launched that converts TypePad and Movable Type export files into WordPre

About


Advertisements