Jump to content

submit form once only


stuart7398

Recommended Posts

You could use Javascript to disable the button directly after its been pressed but you can't really prevent people pressing the back button.

 

The best way is to force a user to log on to your system and then create a flood control to prevent a user submitting something more then once.

 

There is no straight forward answer to your question without getting more detail from yourself.

Link to comment
https://forums.phpfreaks.com/topic/99953-submit-form-once-only/#findComment-511092
Share on other sites

either;

 

1. Set a cookie after the user submits. Then check on the form page if it doesnt exist.

 

OR/AND

 

2. Log the IP-ADDRESS into a File/DB. check for IP ADDRESSES on Form Page (IP-Addresses can Easily be spoofed).

 

OR/AND

 

3. Use session variables (this would be the same as using cookies in effect, but slightly easier to store actual variables.

 

OR/AND (My Personal Option along with option 1/3):

 

4. Like Cep said use flood control, dont let ANYONE submit a form within so many seconds.

-------

 

You can use CSS to easily disable the button, and add "Loading" text etc.

 

hope this helps,

Link to comment
https://forums.phpfreaks.com/topic/99953-submit-form-once-only/#findComment-511096
Share on other sites

NOTE: With sessions, if a user wanted to he could supply a new sessid every submission, so relying just on sessions would not really be as effective as forcing cookies.

 

(If you use cookies don't check if something exists inside it, check for the actual cookie - if it has been set there at all. Remember - Cookies are only text files).

Link to comment
https://forums.phpfreaks.com/topic/99953-submit-form-once-only/#findComment-511097
Share on other sites

NOTE: With sessions, if a user wanted to he could supply a new sessid every submission, so relying just on sessions would not really be as effective as forcing cookies.

 

(If you use cookies don't check if something exists inside it, check for the actual cookie - if it has been set there at all. Remember - Cookies are only text files).

 

hmm... :)

 

But that will stop the user from submitting until the cookie expires. We are left in the dark if that is what the OP really wants. Note also that switching to a different browser or deleting cookies will also allow resubmissions.

 

My guess is he just wants some level of flood control. Sessions will handle this just fine. There's not one single option that will take care of that for good. In that context, a solution that is both simple to implement and doesn't damage the user experience too much is better. Even if that means some attacks may pass.

 

If however the user wants just one submission for life, than... users must login.

Link to comment
https://forums.phpfreaks.com/topic/99953-submit-form-once-only/#findComment-511102
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.