stuart7398 Posted April 7, 2008 Share Posted April 7, 2008 hi. how do i stop users submiting my form by using the back button and submitting repeatedly. thanks, stuart. Link to comment https://forums.phpfreaks.com/topic/99953-submit-form-once-only/ Share on other sites More sharing options...
Cep Posted April 7, 2008 Share Posted April 7, 2008 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 More sharing options...
quiettech Posted April 7, 2008 Share Posted April 7, 2008 Use sessions and create a session variable that you flip to true when the form is first submitted. Test for this flag on every submission. Link to comment https://forums.phpfreaks.com/topic/99953-submit-form-once-only/#findComment-511094 Share on other sites More sharing options...
uniflare Posted April 7, 2008 Share Posted April 7, 2008 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 More sharing options...
uniflare Posted April 7, 2008 Share Posted April 7, 2008 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 More sharing options...
stuart7398 Posted April 7, 2008 Author Share Posted April 7, 2008 Thanks. Very helpful. Link to comment https://forums.phpfreaks.com/topic/99953-submit-form-once-only/#findComment-511100 Share on other sites More sharing options...
quiettech Posted April 7, 2008 Share Posted April 7, 2008 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.