in reply to blocking naughty referrers

try something like:

if ( $ENV{'HTTP_REFERRER'} =~ /dumbdomain.com/ ) { print("Location: http://www.anotherpage.com\n\n"); }
I believe this will work...although, it is untested.

----------
- Jim

Replies are listed 'Best First'.
Re: Re: blocking naughty referrers
by dws (Chancellor) on May 14, 2001 at 10:12 UTC
    Very close, except that you spelled "referrer" correctly, and HTTP doesn't. Fleshed out a bit more, this looks like
    #!/usr/bin/perl if ( defined $ENV{'HTTP_REFERER'} and $ENV{'HTTP_REFERER'} =~ /dumdomain\.com/ ) { print "Location: http://www.anotherpage.com\n\n"; exit(0); } print "Content-type: text/html\n\n"; ...
      Ahh, thank you! I also noticed that I did not escape my '.' in my RE. I wonder what I was thinking.

      ----------
      - Jim

      ok i tried this version because i didn't want to send people back to where they came from, but instead a more *constructive* site.

      unfortunately i'm still getting "an error occurred while processing this directive". yuck.

      any ideas?

        unfortunately i'm still getting "an error occurred while processing this directive".

        I hope you didn't take the "<code>...<code>" in my example literally. :)

        For hints on debugging CGIs, see CGI Programming.