Is the code below effective in disallowng submission of an altered form?

No! It is just as easy to alter the headers as it is to alter the form. You shouldn't focus on whether you think the user changed the form. Instead focus on what values your script expects and make sure that you check those values before you use them.

Whether or not the user changed the form is irrelevant as long as you only use the parameters that you expect to recieve in your script, and that those parameters contain values that are within your given constraints.

I would suggest you do some reading on CGI programming and security. A good place to start is probably Ovid's CGI course. Or check out some of the other CGI Tutorials here at the monestary.

- Cees


In reply to Re: CGI form data validation by cees
in thread CGI form data validation by kiat

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.