Fellow Monks,
I have the following snippet in a script which is intended to make sure that only pages on our site may utilize the script. It came to my attention this morning that someone had received the Bad Referer message while (they say) they were moving from one page to another within our site. We have no 3rd level domains, and the site cannot be accessed by proxy (no www) at all, and the pages have been tested hundreds of times without this coming up. Anyone see a flaw in the code or have an idea for a scenario to cause this. I should note that I have only just altered the error message to request mail and plan to log errors but I do not have the referer infomation that triggered this problem.
TIA
jg
my $good_url = 'http://www.thesite.org/'; my $also_good = 'https://www.thesite.org'; my $referer = $ENV{'HTTP_REFERER'}; if ( $referer !~ /^$good_url/ && $referer !~ /^$also_good/) { print $q->header,start_html,h2("Bad Referer."), "If you receive th +is error please ", a( {-href=>"mailto:bug\@nolaflash.com?Subject=New+Member+Bug!+$ref +erer"},"email us"),".";exit; }
_____________________________________________________
"The man who grasps principles can successfully select his own methods.
The man who tries methods, ignoring principles, is sure to have trouble.
~ Ralph Waldo Emerson

In reply to Referer check within domain problem by jerrygarciuh

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.