Re: diplicate entries

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"Bobo Wieland" <dev@xxxxxxxxxxxxx> wrote in message
news:001801c44fa9$a8f089a0$5cea1e0a@xxxxxxxxxxxxxxxxx
> Hi!
>
> What is the best way to check if a record allready exists in a msql-db
from
> php in the case of when the same form is submited twice beacuse of the
> "refresh"-button?
> Should I allways check the db for the same entry, or is there some esier
way
> to prevent the user from submiting a form more then once?
> Btw, is it possible for an sql-query to stop halfway through (if the
server
> goes down or something)?

Please don't hijack threads!

As to your duplicate form submits: This is usually prevented by using a
hidden form element with a randomly generated token (string). When the form
is submitted check if the token already exists in a session array - if not
this is the first submit so store the token in the array and process the
form. If the same form is re-submitted the token will be found in the
session array and therefore the form should not be processed.

IMPORTANT: When creating the random token check if a token with this value
already exists in the session array.

Hope this helps. Regards,

Torsten Roehr

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux