I\'ve spent weeks working on double-submit protection on my forms. Straightup, the session method of storing tokens doesn\'t work.
Sessions work fine for a refres
It seems you need an independant token store capable of avoiding race conditions. To get this to work several solutions are available, one of the easier to implement would be:
microtime()
, possibly even a process-id, or hash, as long as it's very much assured to be unique in similar processes started within moment from each other.UPDATE tokens SET claimid = WHERE tokencode=tokencode AND claimid IS NULL