in reply to Re^3: ERROR - Invalid Referrer
in thread ERROR - Invalid Referrer

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

Replies are listed 'Best First'.
Re^5: ERROR - Invalid Referrer
by jZed (Prior) on May 22, 2005 at 22:19 UTC
    This script appears to be generated by a commercial script genertor. Normally in such cases, I'd recommend that you contact whoever sold you the thing and get them to fix it. But in this case, the code is so *incredibly bad* I can't recommend that you contact them. My real advice is to find a better script (perhpas the formmail replacement at NMS), or pay someone to write one. If you insist on using this script, you could just take out these lines:
    @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 ; }
    Those are the ones that give you the error and although a novice might think they offered some protection, they really don't.
      thank you jZed you are turely a great monk you where right it now works cheers
Re^5: ERROR - Invalid Referrer
by djohnston (Monk) on May 22, 2005 at 23:51 UTC
    To help narrow down the problem, you could print the value of HTTP_REFERER whenever the error occurs.

    print "Content-type: text/html\n\nERROR - Invalid Referrer: ".($ENV{HTTP_REFERER} || '(null string)')."\n"

    Note, however that you can't count on HTTP_REFERER having a value, in fact it's often not sent by the client and is probably the cause of your problem. You also cannot trust it, as it is easily spoofed, so that alone doesn't protect your script from being exploited by spammers.