How can I prevent this? - Printable Version +- Support Forums (https://www.supportforums.net) +-- Forum: Categories (https://www.supportforums.net/forumdisplay.php?fid=87) +--- Forum: Coding Support Forums (https://www.supportforums.net/forumdisplay.php?fid=18) +---- Forum: PHP The Hypertext Preprocessor (https://www.supportforums.net/forumdisplay.php?fid=21) +---- Thread: How can I prevent this? (/showthread.php?tid=11516) |
How can I prevent this? - `P R O D I G Y™ - 08-25-2010 On all of my post and gets, you can just f5 and submit the data over and over, is there an easy way to avoid this? RE: How can I prevent this? - Starky - 08-25-2010 Use a cookie so it can detect if they've F5'd in the last 10 seconds, and if they have then use an if statement to stop the post/get. RE: How can I prevent this? - Orgy - 10-06-2010 (08-25-2010, 04:12 AM)Starky Wrote: Use a cookie so it can detect if they've F5'd in the last 10 seconds, and if they have then use an if statement to stop the post/get.You need us to wipe your ass for you too? There was really no need to be rude about it. @OP: Alternatively, you can store what they POSTed (you should serialize() it) and the time in a mysql table, and if the same data was stored less than x seconds ago, don't process. RE: How can I prevent this? - Disease - 10-06-2010 (08-25-2010, 02:52 AM)`P R O D I G Y™ Wrote: On all of my post and gets, you can just f5 and submit the data over and over, is there an easy way to avoid this? You should be redirecting your users away from the form after it has been validated and executed. Doing so will mean that if your user decides to spam the refresh button they'll be doing so on a safe page. How it might look in pseudocode: Code: if form submitted then RE: How can I prevent this? - Win - 11-26-2010 This is a problem for me too, if they click back, it repeats the GETs. RE: How can I prevent this? - Orgy - 11-30-2010 (10-06-2010, 09:00 PM)Disease Wrote: You should be redirecting your users away from the form after it has been validated and executed. Doing so will mean that if your user decides to spam the refresh button they'll be doing so on a safe page. How it might look in pseudocode: Hey, that would work pretty nicely. But that would mean that each submissApproachion would require its own success page, and if done half-assed (like most of my scripts) it can get messy real quick RE: How can I prevent this? - iCrack - 11-30-2010 I don't know! I'de love a way too avoid that as well. xD RE: How can I prevent this? - Orgy - 12-01-2010 (11-30-2010, 02:47 PM)iCrack Wrote: I don't know! Well considering Disease just explained how to do it, I don't see why you don't know. |