Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

... but if your server is even slightly slow, impatient users WILL mash the stop-button and resubmit or reload your page.   You have to be prepared for whatever happens, on the server side. nbsp; Anything that happens, can happen at any time, and can happen again, and there is nothing you on the server side can do about it.

However, there are various ways to detect it.   One way, which is often used anyway to avoid CSRF attacks, is to include a hidden field on the form which contains a pseudo-random string.   You save that value in the host-side session store before sending the page.   When a reply comes back, that identical string should still be there, and you should be seeing it for the first time.   If you don’t, then you know that the data is either “stale” or resubmitted or a forgery.   (I have also seen sequence-numbers and server-side Unix timestamps in hidden fields.)   But, you, in your server-side programming, must either do this, or be using a framework that does this for you, because the user-side can do whatever it wants, whenever it wants, rightly or wrongly.   This, BTW, is true of every web programming language, since it is inherent in the design of HTTP.   Even Javascript tricks designed to suppress multiple-mashes can be circumvented if the user successfully reloads the page, and you have to assume that, somehow, that’s what he managed to do.

In reply to Re: How to prevent a Reload from resubmitting a form? by sundialsvc4
in thread How to prevent a Reload from resubmitting a form? by gayu_justin

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, 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, 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.
  • Log In?

    What's my password?
    Create A New User
    and all is quiet...

    How do I use this? | Other CB clients
    Other Users?
    Others drinking their drinks and smoking their pipes about the Monastery: (5)
    As of 2017-12-11 13:57 GMT
    Find Nodes?
      Voting Booth?
      What programming language do you hate the most?

      Results (295 votes). Check out past polls.