rbspro has asked for the wisdom of the Perl Monks concerning the following question:

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re: ERROR - Invalid Referrer
by TedPride (Priest) on May 22, 2005 at 23:24 UTC
    The important part is here:
    @valid_ref = ('http://www.willettsbutchers.co.uk') ; foreach $ref (@valid_ref) { if ($ENV{'HTTP_REFERER'} =~ m/$ref/i) {$is_valid = 1 ; last ;} } if (! $is_valid) { print "Content-type: text/html\n\nERROR - Invalid Referrer\n" ; exit 0 ; }
    Either the page you're accessing the script from is not at http://www.willettsbutchers.co.uk, or the server is not giving you a HTTP_REFERER variable.

    Incidently, whoever wrote that script has to be one of the most inefficient coders ever. I wrote prettier code before I started coming to Perlmonks, and that's saying a lot.

Re: ERROR - Invalid Referrer
by tlm (Prior) on May 22, 2005 at 18:49 UTC

    Post some code.

    the lowliest monk

    A reply falls below the community's threshold of quality. You may see it by logging in.
Re: ERROR - Invalid Referrer
by fauria (Deacon) on May 23, 2005 at 07:18 UTC
    I think this question has been already answered, but as a general tip, youd better use other mechanisms rather than rely on HTTP_REFERER for identifying or validating the source of anything, as it can be overwritten easily with tools like curl or something else.

    HTTP headers are ok for statistical info, such as where people comes from to our site through what links, but are a little bit risky if you base part of your security or integrity on them.