Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

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

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!
  • 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
  • Outside of code tags, you may need to use entities for some characters:
            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?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others exploiting the Monastery: (4)
    As of 2014-10-26 05:06 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      For retirement, I am banking on:










      Results (151 votes), past polls