Beefy Boxes and Bandwidth Generously Provided by pair Networks vroom
Perl-Sensitive Sunglasses
 
PerlMonks  

ERROR - Invalid Referrer

by rbspro (Initiate)
on May 22, 2005 at 14:46 UTC ( [id://459371]=perlquestion: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.

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

Having problems with a script running windows xp with two user accounts script works fine on one user but on the other I'm getting a ERROR - Invalid Referrer.

can anyone help as script works fine on the other users side (sends email to them and also to me)

the scripts at http://www.willettsbutchers.co.uk/contactus/contactus.htm

Replies are listed 'Best First'.
Re: ERROR - Invalid Referrer
by tlm (Prior) on May 22, 2005 at 14:49 UTC

    Post some code.

    the lowliest monk

      script is at http://www.willettsbutchers.co.uk/contactus/contactus.htm

        suggestions for posting are at http://www.perlmonks.org/index.pl?node=How%20%28not%29%20to%20ask%20a%20question

        Update: The link is How (Not) To Ask A Question. I was trying to duplicate the format of the message I'm replying to, at my bad attempt at humor.

        In the first place, it's rude to expect us to go clicking links to find out what you're talking about. In the second place, when future monks visit this node, they won't know what the node is about because that link will either no longer be there, or presumbably be fixed. And in the third place, that link goes to an HTML page, it doesn't give us the slightest idea about any perl code. The only way we can help you with your perl code is for you to show us your perl code (or a trimmed down sample), not for you to show us the HTML page that submits a form to the perl script.
Re: ERROR - Invalid Referrer
by TedPride (Priest) on May 22, 2005 at 19: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 fauria (Deacon) on May 23, 2005 at 03: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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://459371]
Approved by tlm
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.