I'm sorry if this has already been asked, but I can't find an answer to this question anywhere even though it should be a common problem.

I have a Perl/CGI page which I will call foo.cgi. In foo.cgi, I have a form which action is to submit back to foo.cgi (<FORM name='form1' method='post' action='foo.cgi'). When the page reloads, if I detect that the form was submitted, I validate the input and then, if necessary, send the data off to one of about 10 other CGI pages, depending on which option the user selected in the form. I will call one of these other CGI pages bar.cgi. I call bar.cgi using an HTML meta refresh and pass in variables in the URL string using the GET method (<META http-equiv='refresh' content='0; URL=bar.cgi?array1=value1&array1=value2'>).

My question is, how do I validate in bar.cgi that foo.cgi called it? I don't want users being able to call bar.cgi directly entering in any value for any variable they want in the URL. My only idea was to use the referer() method in the CGI package, but apparently that method doesn't find any value when a META refresh is used. Any other ideas? If there's a better way to call bar.cgi from foo.cgi, I'd be open to it.


In reply to Detect CGI page caller by Only1KW

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.